File fix-qt-check.diff of Package libqca2
--- qca-gnupg.cpp
+++ qca-gnupg.cpp
@@ -41,35 +41,54 @@
namespace gpgQCAPlugin {
+#ifdef Q_OS_LINUX
static int qVersionInt()
{
static int out = -1;
- if(out == -1) {
+ if(out == -1)
+ {
QString str = QString::fromLatin1(qVersion());
QStringList parts = str.split('.', QString::KeepEmptyParts);
- Q_ASSERT(parts.count() == 3);
+ if(parts.count() != 3)
+ {
+ out = 0;
+ return out;
+ }
+
out = 0;
- for(int n = 0; n < 3; ++n) {
+ for(int n = 0; n < 3; ++n)
+ {
bool ok;
int x = parts[n].toInt(&ok);
- Q_ASSERT(ok);
- Q_ASSERT(x > 0 && x <= 0xff);
- out <<= x;
+ if(ok && x >= 0 && x <= 0xff)
+ {
+ out <<= 8;
+ out += x;
+ }
+ else
+ {
+ out = 0;
+ return out;
+ }
}
}
return out;
}
-#ifdef Q_OS_LINUX
static bool qt_buggy_fsw()
{
- // FIXME: just a guess that this is fixed in 4.3.5 and 4.4.0
- if(qVersionInt() < 0x040305)
+ // fixed in 4.3.5 and 4.4.1
+ int ver = qVersionInt();
+ int majmin = ver >> 8;
+ if(majmin < 0x0403)
return true;
- else
- return false;
+ else if(majmin == 0x0403 && ver < 0x040305)
+ return true;
+ else if(majmin == 0x0404 && ver < 0x040401)
+ return true;
+ return false;
}
#else
static bool qt_buggy_fsw()
@@ -603,7 +622,8 @@
// problem, we'll watch the directories containing the keyring files
// instead of watching the actual files themselves.
//
-// FIXME: consider moving this logic into FileWatch
+// FIXME: qca 2.0.1 FileWatch has this logic already, so we can probably
+// simplify this class.
class RingWatch : public QObject
{
Q_OBJECT
@@ -1131,10 +1151,10 @@
// secret keyring filename
else if(init_step == 1)
{
- secring = gpg.keyringFile();
+ secring = QFileInfo(gpg.keyringFile()).canonicalFilePath();
if(qt_buggy_fsw())
- fprintf(stderr, "qca-gnupg: disabling keyring monitoring due to buggy Qt version\n");
+ fprintf(stderr, "qca-gnupg: disabling keyring monitoring in Qt version < 4.3.5 or 4.4.1\n");
if(!secring.isEmpty())
{
@@ -1149,7 +1169,7 @@
// public keyring filename
else if(init_step == 2)
{
- pubring = gpg.keyringFile();
+ pubring = QFileInfo(gpg.keyringFile()).canonicalFilePath();
if(!pubring.isEmpty())
{
if(!qt_buggy_fsw())