#include <QtCore/QSet>
#include <QtCore/QString>
#include <QtCore/QVariant>
-#include <QtCore/QUuid>
#include <QtGui/QPixmap>
#include <QtXml/qdom.h>
++it;
}
+static inline QString createAnnotationID()
+{
+#if QT_VERSION >= 0x041200
+ return QString::fromLatin1(qRandomUuid());
+#else
+ return QString::number(qrand());
+#endif
+}
+
PagePrivate::PagePrivate( Page *page, uint n, double w, double h, Rotation o )
: m_page( page ), m_number( n ), m_orientation( o ),
m_width( w ), m_height( h ), m_doc( 0 ), m_boundingBox( 0, 0, 1, 1 ),
void Page::addAnnotation( Annotation * annotation )
{
- // Generate uniqueName: okular-{UUID}
+ // Generate uniqueName: okular-UUID
if(annotation->uniqueName().isEmpty())
{
- QString uniqueName = "okular-" + QUuid::createUuid().toString();
+ QString uniqueName = "okular-" + createAnnotationID();
annotation->setUniqueName( uniqueName );
}
annotation->d_ptr->m_page = d;
#include <config.h>
+#if QT_VERSION < 0x041200
+# include <QUuid>
+#endif
+
/** Creates a new FileSystem object
@param firstsector the first sector used by this FileSystem on the Device
@param lastsector the last sector used by this FileSystem on the Device
return cmd.exitCode() == 0 || cmd.exitCode() == expectedCode;
}
+/**
+ @return UUID in the form: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
+*/
+QString FileSystem::createUUID()
+{
+#if QT_VERSION >= 0x041200
+ return QString::fromLatin1(qRandomUuid());
+#else
+ return QUuid::createUuid().toString().remove(QRegExp("\\{|\\}"));
+#endif
+}
+
FileSystem::Type FileSystem::defaultFileSystem()
{
return static_cast<FileSystem::Type>(Config::defaultFileSystem());
protected:
static bool findExternal(const QString& cmdName, const QStringList& args = QStringList(), int exptectedCode = 1);
+ static QString createUUID();
protected:
FileSystem::Type m_Type;
#include "util/externalcommand.h"
#include <QString>
-#include <QUuid>
#include <KLocale>
bool luks::updateUUID(Report& report, const QString& deviceNode) const
{
- QUuid uuid = QUuid::createUuid();
-
- ExternalCommand cmd(report, "cryptsetup", QStringList() << "luksUUID" << deviceNode << "--uuid" << uuid.toString());
+ ExternalCommand cmd(report, "cryptsetup", QStringList() << "luksUUID" << deviceNode << "--uuid" << createUUID());
return cmd.run(-1) && cmd.exitCode() == 0;
}
#include <cmath>
#include <QString>
-#include <QUuid>
#include <KLocale>
#include <KTempDir>
bool nilfs2::updateUUID(Report& report, const QString& deviceNode) const
{
- QUuid uuid = QUuid::createUuid();
- ExternalCommand cmd(report, "nilfs-tune", QStringList() << "-U" << uuid.toString() << deviceNode);
+ ExternalCommand cmd(report, "nilfs-tune", QStringList() << "-U" << createUUID() << deviceNode);
return cmd.run(-1) && cmd.exitCode() == 0;
}
}
#include <QString>
#include <QStringList>
#include <QRegExp>
-#include <QUuid>
namespace FS
{
bool reiserfs::updateUUID(Report& report, const QString& deviceNode) const
{
- const QString uuid = QUuid::createUuid().toString().remove(QRegExp("\\{|\\}"));
- ExternalCommand cmd(report, "reiserfstune", QStringList() << "-u" << uuid << deviceNode);
+ ExternalCommand cmd(report, "reiserfstune", QStringList() << "-u" << createUUID() << deviceNode);
return cmd.run(-1) && cmd.exitCode() == 0;
}
}