summaryrefslogtreecommitdiffstats
path: root/digikam/kioslave/digikamsearch.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'digikam/kioslave/digikamsearch.cpp')
-rw-r--r--digikam/kioslave/digikamsearch.cpp204
1 files changed, 102 insertions, 102 deletions
diff --git a/digikam/kioslave/digikamsearch.cpp b/digikam/kioslave/digikamsearch.cpp
index b6eee9fc..d45db620 100644
--- a/digikam/kioslave/digikamsearch.cpp
+++ b/digikam/kioslave/digikamsearch.cpp
@@ -40,15 +40,15 @@ extern "C"
#include <cstdio>
#include <ctime>
-// Qt includes.
+// TQt includes.
-#include <qfile.h>
-#include <qdatastream.h>
-#include <qtextstream.h>
-#include <qregexp.h>
-#include <qdir.h>
-#include <qvariant.h>
-#include <qmap.h>
+#include <tqfile.h>
+#include <tqdatastream.h>
+#include <tqtextstream.h>
+#include <tqregexp.h>
+#include <tqdir.h>
+#include <tqvariant.h>
+#include <tqmap.h>
// KDE includes.
@@ -68,8 +68,8 @@ extern "C"
#include "digikam_export.h"
#include "digikamsearch.h"
-kio_digikamsearch::kio_digikamsearch(const QCString &pool_socket,
- const QCString &app_socket)
+kio_digikamsearch::kio_digikamsearch(const TQCString &pool_socket,
+ const TQCString &app_socket)
: SlaveBase("kio_digikamsearch", pool_socket, app_socket)
{
// build a lookup table for month names
@@ -85,31 +85,31 @@ kio_digikamsearch::~kio_digikamsearch()
{
}
-static QValueList<QRegExp> makeFilterList( const QString &filter )
+static TQValueList<TQRegExp> makeFilterList( const TQString &filter )
{
- QValueList<QRegExp> regExps;
+ TQValueList<TQRegExp> regExps;
if ( filter.isEmpty() )
return regExps;
- QChar sep( ';' );
- int i = filter.find( sep, 0 );
- if ( i == -1 && filter.find( ' ', 0 ) != -1 )
- sep = QChar( ' ' );
+ TQChar sep( ';' );
+ int i = filter.tqfind( sep, 0 );
+ if ( i == -1 && filter.tqfind( ' ', 0 ) != -1 )
+ sep = TQChar( ' ' );
- QStringList list = QStringList::split( sep, filter );
- QStringList::Iterator it = list.begin();
+ TQStringList list = TQStringList::split( sep, filter );
+ TQStringList::Iterator it = list.begin();
while ( it != list.end() )
{
- regExps << QRegExp( (*it).stripWhiteSpace(), false, true );
+ regExps << TQRegExp( (*it).stripWhiteSpace(), false, true );
++it;
}
return regExps;
}
-static bool matchFilterList( const QValueList<QRegExp>& filters,
- const QString &fileName )
+static bool matchFilterList( const TQValueList<TQRegExp>& filters,
+ const TQString &fileName )
{
- QValueList<QRegExp>::ConstIterator rit = filters.begin();
+ TQValueList<TQRegExp>::ConstIterator rit = filters.begin();
while ( rit != filters.end() )
{
if ( (*rit).exactMatch(fileName) )
@@ -119,17 +119,17 @@ static bool matchFilterList( const QValueList<QRegExp>& filters,
return false;
}
-void kio_digikamsearch::special(const QByteArray& data)
+void kio_digikamsearch::special(const TQByteArray& data)
{
- QString libraryPath;
+ TQString libraryPath;
KURL url;
- QString filter;
+ TQString filter;
int getDimensions;
int listingType = 0;
int recurseAlbums;
int recurseTags;
- QDataStream ds(data, IO_ReadOnly);
+ TQDataStream ds(data, IO_ReadOnly);
ds >> libraryPath;
ds >> url;
ds >> filter;
@@ -147,12 +147,12 @@ void kio_digikamsearch::special(const QByteArray& data)
m_db.openDB(libraryPath);
}
- QValueList<QRegExp> regex = makeFilterList(filter);
- QByteArray ba;
+ TQValueList<TQRegExp> regex = makeFilterList(filter);
+ TQByteArray ba;
if (listingType == 0)
{
- QString sqlQuery;
+ TQString sqlQuery;
// query head
sqlQuery = "SELECT Images.id, Images.name, Images.dirid, Images.datetime, Albums.url "
@@ -166,27 +166,27 @@ void kio_digikamsearch::special(const QByteArray& data)
sqlQuery += " ) ";
sqlQuery += " AND (Albums.id=Images.dirid); ";
- QStringList values;
- QString errMsg;
+ TQStringList values;
+ TQString errMsg;
if (!m_db.execSql(sqlQuery, &values))
{
error(KIO::ERR_INTERNAL, errMsg);
return;
}
- Q_LLONG imageid;
- QString name;
- QString path;
+ TQ_LLONG imageid;
+ TQString name;
+ TQString path;
int dirid;
- QString date;
- QString purl;
- QSize dims;
+ TQString date;
+ TQString purl;
+ TQSize dims;
struct stat stbuf;
int count = 0;
- QDataStream* os = new QDataStream(ba, IO_WriteOnly);
+ TQDataStream* os = new TQDataStream(ba, IO_WriteOnly);
- for (QStringList::iterator it = values.begin(); it != values.end();)
+ for (TQStringList::iterator it = values.begin(); it != values.end();)
{
imageid = (*it).toLongLong();
++it;
@@ -203,10 +203,10 @@ void kio_digikamsearch::special(const QByteArray& data)
continue;
path = m_libraryPath + purl + '/' + name;
- if (::stat(QFile::encodeName(path), &stbuf) != 0)
+ if (::stat(TQFile::encodeName(path), &stbuf) != 0)
continue;
- dims = QSize();
+ dims = TQSize();
if (getDimensions)
{
KFileMetaInfo metaInfo(path);
@@ -248,7 +248,7 @@ void kio_digikamsearch::special(const QByteArray& data)
ba.resize(0);
count = 0;
- os = new QDataStream(ba, IO_WriteOnly);
+ os = new TQDataStream(ba, IO_WriteOnly);
}
}
@@ -256,7 +256,7 @@ void kio_digikamsearch::special(const QByteArray& data)
}
else
{
- QString sqlQuery;
+ TQString sqlQuery;
// query head
sqlQuery = "SELECT Albums.url||'/'||Images.name "
@@ -271,16 +271,16 @@ void kio_digikamsearch::special(const QByteArray& data)
sqlQuery += " AND (Albums.id=Images.dirid) ";
sqlQuery += " LIMIT 500;";
- QStringList values;
- QString errMsg;
+ TQStringList values;
+ TQString errMsg;
if (!m_db.execSql(sqlQuery, &values, &errMsg))
{
error(KIO::ERR_INTERNAL, errMsg);
return;
}
- QDataStream ds(ba, IO_WriteOnly);
- for (QStringList::iterator it = values.begin(); it != values.end(); ++it)
+ TQDataStream ds(ba, IO_WriteOnly);
+ for (TQStringList::iterator it = values.begin(); it != values.end(); ++it)
{
if (matchFilterList(regex, *it))
{
@@ -294,20 +294,20 @@ void kio_digikamsearch::special(const QByteArray& data)
finished();
}
-QString kio_digikamsearch::buildQuery(const KURL& url) const
+TQString kio_digikamsearch::buildQuery(const KURL& url) const
{
int count = url.queryItem("count").toInt();
if (count <= 0)
- return QString();
+ return TQString();
- QMap<int, RuleType> rulesMap;
+ TQMap<int, RuleType> rulesMap;
for (int i=1; i<=count; i++)
{
RuleType rule;
- QString key = url.queryItem(QString::number(i) + ".key").lower();
- QString op = url.queryItem(QString::number(i) + ".op").lower();
+ TQString key = url.queryItem(TQString::number(i) + ".key").lower();
+ TQString op = url.queryItem(TQString::number(i) + ".op").lower();
if (key == "album")
{
@@ -383,15 +383,15 @@ QString kio_digikamsearch::buildQuery(const KURL& url) const
continue;
}
- rule.val = url.queryItem(QString::number(i) + ".val");
+ rule.val = url.queryItem(TQString::number(i) + ".val");
rulesMap.insert(i, rule);
}
- QString sqlQuery;
+ TQString sqlQuery;
- QStringList strList = QStringList::split(" ", url.path());
- for ( QStringList::Iterator it = strList.begin(); it != strList.end(); ++it )
+ TQStringList strList = TQStringList::split(" ", url.path());
+ for ( TQStringList::Iterator it = strList.begin(); it != strList.end(); ++it )
{
bool ok;
int num = (*it).toInt(&ok);
@@ -401,7 +401,7 @@ QString kio_digikamsearch::buildQuery(const KURL& url) const
if (rule.key == KEYWORD)
{
bool exact;
- QString possDate = possibleDate(rule.val, exact);
+ TQString possDate = possibleDate(rule.val, exact);
if (!possDate.isEmpty())
{
rule.key = IMAGEDATE;
@@ -419,7 +419,7 @@ QString kio_digikamsearch::buildQuery(const KURL& url) const
}
else
{
- QValueList<SKey> todo;
+ TQValueList<SKey> todo;
todo.append( ALBUMNAME );
todo.append( IMAGENAME );
todo.append( TAGNAME );
@@ -429,7 +429,7 @@ QString kio_digikamsearch::buildQuery(const KURL& url) const
todo.append( RATING );
sqlQuery += '(';
- QValueListIterator<SKey> it;
+ TQValueListIterator<SKey> it;
it = todo.begin();
while ( it != todo.end() )
{
@@ -455,11 +455,11 @@ QString kio_digikamsearch::buildQuery(const KURL& url) const
return sqlQuery;
}
-QString kio_digikamsearch::subQuery(enum kio_digikamsearch::SKey key,
+TQString kio_digikamsearch::subQuery(enum kio_digikamsearch::SKey key,
enum kio_digikamsearch::SOperator op,
- const QString& val) const
+ const TQString& val) const
{
- QString query;
+ TQString query;
switch (key)
{
@@ -471,8 +471,8 @@ QString kio_digikamsearch::subQuery(enum kio_digikamsearch::SKey key,
query = " (Images.dirid IN "
" (SELECT a.id FROM Albums a, Albums b "
" WHERE a.url $$##$$ '%' || b.url || '%' AND b.id = $$@@$$))";
- query.replace("$$@@$$", QString::fromLatin1("'") + escapeString(val)
- + QString::fromLatin1("'"));
+ query.tqreplace("$$@@$$", TQString::tqfromLatin1("'") + escapeString(val)
+ + TQString::tqfromLatin1("'"));
break;
}
case(ALBUMNAME):
@@ -516,8 +516,8 @@ QString kio_digikamsearch::subQuery(enum kio_digikamsearch::SKey key,
// " (SELECT imageid FROM ImageTags "
// " WHERE tagid $$##$$ $$@@$$)) ";
- query.replace("$$@@$$", QString::fromLatin1("'") + escapeString(val)
- + QString::fromLatin1("'"));
+ query.tqreplace("$$@@$$", TQString::tqfromLatin1("'") + escapeString(val)
+ + TQString::tqfromLatin1("'"));
break;
}
@@ -544,8 +544,8 @@ QString kio_digikamsearch::subQuery(enum kio_digikamsearch::SKey key,
" WHERE TagsTree.pid = (SELECT id FROM Tags WHERE name LIKE $$@@$$) "
" OR ImageTags.tagid = (SELECT id FROM Tags WHERE name LIKE $$@@$$) )) ";
-// query.replace("$$@@$$", QString::fromLatin1("'") + escapeString(val)
-// + QString::fromLatin1("'"));
+// query.tqreplace("$$@@$$", TQString::tqfromLatin1("'") + escapeString(val)
+// + TQString::tqfromLatin1("'"));
break;
}
@@ -595,58 +595,58 @@ QString kio_digikamsearch::subQuery(enum kio_digikamsearch::SKey key,
{
case(EQ):
{
- query.replace("$$##$$", "=");
- query.replace("$$@@$$", QString::fromLatin1("'") + escapeString(val)
- + QString::fromLatin1("'"));
+ query.tqreplace("$$##$$", "=");
+ query.tqreplace("$$@@$$", TQString::tqfromLatin1("'") + escapeString(val)
+ + TQString::tqfromLatin1("'"));
break;
}
case(NE):
{
- query.replace("$$##$$", "<>");
- query.replace("$$@@$$", QString::fromLatin1("'") + escapeString(val)
- + QString::fromLatin1("'"));
+ query.tqreplace("$$##$$", "<>");
+ query.tqreplace("$$@@$$", TQString::tqfromLatin1("'") + escapeString(val)
+ + TQString::tqfromLatin1("'"));
break;
}
case(LT):
{
- query.replace("$$##$$", "<");
- query.replace("$$@@$$", QString::fromLatin1("'") + escapeString(val)
- + QString::fromLatin1("'"));
+ query.tqreplace("$$##$$", "<");
+ query.tqreplace("$$@@$$", TQString::tqfromLatin1("'") + escapeString(val)
+ + TQString::tqfromLatin1("'"));
break;
}
case(GT):
{
- query.replace("$$##$$", ">");
- query.replace("$$@@$$", QString::fromLatin1("'") + escapeString(val)
- + QString::fromLatin1("'"));
+ query.tqreplace("$$##$$", ">");
+ query.tqreplace("$$@@$$", TQString::tqfromLatin1("'") + escapeString(val)
+ + TQString::tqfromLatin1("'"));
break;
}
case(LTE):
{
- query.replace("$$##$$", "<=");
- query.replace("$$@@$$", QString::fromLatin1("'") + escapeString(val)
- + QString::fromLatin1("'"));
+ query.tqreplace("$$##$$", "<=");
+ query.tqreplace("$$@@$$", TQString::tqfromLatin1("'") + escapeString(val)
+ + TQString::tqfromLatin1("'"));
break;
}
case(GTE):
{
- query.replace("$$##$$", ">=");
- query.replace("$$@@$$", QString::fromLatin1("'") + escapeString(val)
- + QString::fromLatin1("'"));
+ query.tqreplace("$$##$$", ">=");
+ query.tqreplace("$$@@$$", TQString::tqfromLatin1("'") + escapeString(val)
+ + TQString::tqfromLatin1("'"));
break;
}
case(LIKE):
{
- query.replace("$$##$$", "LIKE");
- query.replace("$$@@$$", QString::fromLatin1("'%") + escapeString(val)
- + QString::fromLatin1("%'"));
+ query.tqreplace("$$##$$", "LIKE");
+ query.tqreplace("$$@@$$", TQString::tqfromLatin1("'%") + escapeString(val)
+ + TQString::tqfromLatin1("%'"));
break;
}
case(NLIKE):
{
- query.replace("$$##$$", "NOT LIKE");
- query.replace("$$@@$$", QString::fromLatin1("'%") + escapeString(val)
- + QString::fromLatin1("%'"));
+ query.tqreplace("$$##$$", "NOT LIKE");
+ query.tqreplace("$$@@$$", TQString::tqfromLatin1("'%") + escapeString(val)
+ + TQString::tqfromLatin1("%'"));
break;
}
}
@@ -656,13 +656,13 @@ QString kio_digikamsearch::subQuery(enum kio_digikamsearch::SKey key,
// we need to split it into two rules
if (key == IMAGEDATE && op == EQ)
{
- QDate date = QDate::fromString(val, Qt::ISODate);
+ TQDate date = TQDate::fromString(val, Qt::ISODate);
if (!date.isValid())
return query;
- query = QString(" (Images.datetime > '%1' AND Images.datetime < '%2') ")
- .arg(date.addDays(-1).toString(Qt::ISODate))
- .arg(date.addDays( 1).toString(Qt::ISODate));
+ query = TQString(" (Images.datetime > '%1' AND Images.datetime < '%2') ")
+ .tqarg(date.addDays(-1).toString(Qt::ISODate))
+ .tqarg(date.addDays( 1).toString(Qt::ISODate));
}
return query;
@@ -692,9 +692,9 @@ extern "C"
}
}
-QString kio_digikamsearch::possibleDate(const QString& str, bool& exact) const
+TQString kio_digikamsearch::possibleDate(const TQString& str, bool& exact) const
{
- QDate date = QDate::fromString(str, Qt::ISODate);
+ TQDate date = TQDate::fromString(str, Qt::ISODate);
if (date.isValid())
{
exact = true;
@@ -708,10 +708,10 @@ QString kio_digikamsearch::possibleDate(const QString& str, bool& exact) const
if (ok)
{
// ok. its an int, does it look like a year?
- if (1970 <= num && num <= QDate::currentDate().year())
+ if (1970 <= num && num <= TQDate::tqcurrentDate().year())
{
// very sure its a year
- return QString("%1-%-%").arg(num);
+ return TQString("%1-%-%").tqarg(num);
}
}
else
@@ -722,7 +722,7 @@ QString kio_digikamsearch::possibleDate(const QString& str, bool& exact) const
if (str.lower() == m_shortMonths[i-1] ||
str.lower() == m_longMonths[i-1])
{
- QString monGlob;
+ TQString monGlob;
monGlob.sprintf("%.2d", i);
monGlob = "%-" + monGlob + "-%";
return monGlob;
@@ -730,5 +730,5 @@ QString kio_digikamsearch::possibleDate(const QString& str, bool& exact) const
}
}
- return QString();
+ return TQString();
}