|
|
|
@ -432,7 +432,7 @@ int AlbumDB::addAlbum(const TQString& url, const TQString& caption,
|
|
|
|
|
|
|
|
|
|
execSql( TQString("REPLACE INTO Albums (url, date, caption, collection) "
|
|
|
|
|
"VALUES('%1', '%2', '%3', '%4');")
|
|
|
|
|
.tqarg(escapeString(url),
|
|
|
|
|
.arg(escapeString(url),
|
|
|
|
|
date.toString(Qt::ISODate),
|
|
|
|
|
escapeString(caption),
|
|
|
|
|
escapeString(collection)));
|
|
|
|
@ -444,29 +444,29 @@ int AlbumDB::addAlbum(const TQString& url, const TQString& caption,
|
|
|
|
|
void AlbumDB::setAlbumCaption(int albumID, const TQString& caption)
|
|
|
|
|
{
|
|
|
|
|
execSql( TQString("UPDATE Albums SET caption='%1' WHERE id=%2;")
|
|
|
|
|
.tqarg(escapeString(caption),
|
|
|
|
|
.arg(escapeString(caption),
|
|
|
|
|
TQString::number(albumID) ));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AlbumDB::setAlbumCollection(int albumID, const TQString& collection)
|
|
|
|
|
{
|
|
|
|
|
execSql( TQString("UPDATE Albums SET collection='%1' WHERE id=%2;")
|
|
|
|
|
.tqarg(escapeString(collection),
|
|
|
|
|
.arg(escapeString(collection),
|
|
|
|
|
TQString::number(albumID)) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AlbumDB::setAlbumDate(int albumID, const TQDate& date)
|
|
|
|
|
{
|
|
|
|
|
execSql( TQString("UPDATE Albums SET date='%1' WHERE id=%2;")
|
|
|
|
|
.tqarg(date.toString(Qt::ISODate))
|
|
|
|
|
.tqarg(albumID) );
|
|
|
|
|
.arg(date.toString(Qt::ISODate))
|
|
|
|
|
.arg(albumID) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AlbumDB::setAlbumIcon(int albumID, TQ_LLONG iconID)
|
|
|
|
|
{
|
|
|
|
|
execSql( TQString("UPDATE Albums SET icon=%1 WHERE id=%2;")
|
|
|
|
|
.tqarg(iconID)
|
|
|
|
|
.tqarg(albumID) );
|
|
|
|
|
.arg(iconID)
|
|
|
|
|
.arg(albumID) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -478,7 +478,7 @@ TQString AlbumDB::getAlbumIcon(int albumID)
|
|
|
|
|
" LEFT OUTER JOIN Images AS I ON I.id=A.icon \n "
|
|
|
|
|
" LEFT OUTER JOIN Albums AS B ON B.id=I.dirid \n "
|
|
|
|
|
"WHERE A.id=%1;")
|
|
|
|
|
.tqarg(albumID), &values );
|
|
|
|
|
.arg(albumID), &values );
|
|
|
|
|
if (values.isEmpty())
|
|
|
|
|
return TQString();
|
|
|
|
|
|
|
|
|
@ -499,7 +499,7 @@ TQString AlbumDB::getAlbumIcon(int albumID)
|
|
|
|
|
void AlbumDB::deleteAlbum(int albumID)
|
|
|
|
|
{
|
|
|
|
|
execSql( TQString("DELETE FROM Albums WHERE id=%1")
|
|
|
|
|
.tqarg(albumID) );
|
|
|
|
|
.arg(albumID) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int AlbumDB::addTag(int parentTagID, const TQString& name, const TQString& iconKDE,
|
|
|
|
@ -510,8 +510,8 @@ int AlbumDB::addTag(int parentTagID, const TQString& name, const TQString& iconK
|
|
|
|
|
|
|
|
|
|
if (!execSql( TQString("INSERT INTO Tags (pid, name) "
|
|
|
|
|
"VALUES( %1, '%2')")
|
|
|
|
|
.tqarg(parentTagID)
|
|
|
|
|
.tqarg(escapeString(name))))
|
|
|
|
|
.arg(parentTagID)
|
|
|
|
|
.arg(escapeString(name))))
|
|
|
|
|
{
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
@ -521,14 +521,14 @@ int AlbumDB::addTag(int parentTagID, const TQString& name, const TQString& iconK
|
|
|
|
|
if (!iconKDE.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
execSql( TQString("UPDATE Tags SET iconkde='%1' WHERE id=%2;")
|
|
|
|
|
.tqarg(escapeString(iconKDE),
|
|
|
|
|
.arg(escapeString(iconKDE),
|
|
|
|
|
TQString::number(id)));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
execSql( TQString("UPDATE Tags SET icon=%1 WHERE id=%2;")
|
|
|
|
|
.tqarg(iconID)
|
|
|
|
|
.tqarg(id));
|
|
|
|
|
.arg(iconID)
|
|
|
|
|
.arg(id));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return id;
|
|
|
|
@ -537,7 +537,7 @@ int AlbumDB::addTag(int parentTagID, const TQString& name, const TQString& iconK
|
|
|
|
|
void AlbumDB::deleteTag(int tagID)
|
|
|
|
|
{
|
|
|
|
|
execSql( TQString("DELETE FROM Tags WHERE id=%1")
|
|
|
|
|
.tqarg(tagID) );
|
|
|
|
|
.arg(tagID) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AlbumDB::setTagIcon(int tagID, const TQString& iconKDE, TQ_LLONG iconID)
|
|
|
|
@ -545,14 +545,14 @@ void AlbumDB::setTagIcon(int tagID, const TQString& iconKDE, TQ_LLONG iconID)
|
|
|
|
|
if (!iconKDE.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
execSql( TQString("UPDATE Tags SET iconkde='%1', icon=0 WHERE id=%2;")
|
|
|
|
|
.tqarg(escapeString(iconKDE),
|
|
|
|
|
.arg(escapeString(iconKDE),
|
|
|
|
|
TQString::number(tagID)));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
execSql( TQString("UPDATE Tags SET icon=%1 WHERE id=%2;")
|
|
|
|
|
.tqarg(iconID)
|
|
|
|
|
.tqarg(tagID));
|
|
|
|
|
.arg(iconID)
|
|
|
|
|
.arg(tagID));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -564,7 +564,7 @@ TQString AlbumDB::getTagIcon(int tagID)
|
|
|
|
|
" LEFT OUTER JOIN Images AS I ON I.id=T.icon \n "
|
|
|
|
|
" LEFT OUTER JOIN Albums AS A ON A.id=I.dirid \n "
|
|
|
|
|
"WHERE T.id=%1;")
|
|
|
|
|
.tqarg(tagID), &values );
|
|
|
|
|
.arg(tagID), &values );
|
|
|
|
|
|
|
|
|
|
if (values.isEmpty())
|
|
|
|
|
return TQString();
|
|
|
|
@ -597,8 +597,8 @@ TQString AlbumDB::getTagIcon(int tagID)
|
|
|
|
|
void AlbumDB::setTagParentID(int tagID, int newParentTagID)
|
|
|
|
|
{
|
|
|
|
|
execSql( TQString("UPDATE Tags SET pid=%1 WHERE id=%2;")
|
|
|
|
|
.tqarg(newParentTagID)
|
|
|
|
|
.tqarg(tagID) );
|
|
|
|
|
.arg(newParentTagID)
|
|
|
|
|
.arg(tagID) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int AlbumDB::addSearch(const TQString& name, const KURL& url)
|
|
|
|
@ -624,7 +624,7 @@ void AlbumDB::updateSearch(int searchID, const TQString& name,
|
|
|
|
|
{
|
|
|
|
|
TQString str = TQString("UPDATE Searches SET name='$$@@$$', url='$$##$$' \n"
|
|
|
|
|
"WHERE id=%1")
|
|
|
|
|
.tqarg(searchID);
|
|
|
|
|
.arg(searchID);
|
|
|
|
|
str.replace("$$@@$$", escapeString(name));
|
|
|
|
|
str.replace("$$##$$", escapeString(url.url()));
|
|
|
|
|
|
|
|
|
@ -634,14 +634,14 @@ void AlbumDB::updateSearch(int searchID, const TQString& name,
|
|
|
|
|
void AlbumDB::deleteSearch(int searchID)
|
|
|
|
|
{
|
|
|
|
|
execSql( TQString("DELETE FROM Searches WHERE id=%1")
|
|
|
|
|
.tqarg(searchID) );
|
|
|
|
|
.arg(searchID) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AlbumDB::setSetting(const TQString& keyword,
|
|
|
|
|
const TQString& value )
|
|
|
|
|
{
|
|
|
|
|
execSql( TQString("REPLACE into Settings VALUES ('%1','%2');")
|
|
|
|
|
.tqarg(escapeString(keyword),
|
|
|
|
|
.arg(escapeString(keyword),
|
|
|
|
|
escapeString(value) ));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -650,7 +650,7 @@ TQString AlbumDB::getSetting(const TQString& keyword)
|
|
|
|
|
TQStringList values;
|
|
|
|
|
execSql( TQString("SELECT value FROM Settings "
|
|
|
|
|
"WHERE keyword='%1';")
|
|
|
|
|
.tqarg(escapeString(keyword)), &values );
|
|
|
|
|
.arg(escapeString(keyword)), &values );
|
|
|
|
|
|
|
|
|
|
if (values.isEmpty())
|
|
|
|
|
return TQString();
|
|
|
|
@ -729,7 +729,7 @@ TQString AlbumDB::getItemCaption(TQ_LLONG imageID)
|
|
|
|
|
|
|
|
|
|
execSql( TQString("SELECT caption FROM Images "
|
|
|
|
|
"WHERE id=%1;")
|
|
|
|
|
.tqarg(imageID),
|
|
|
|
|
.arg(imageID),
|
|
|
|
|
&values );
|
|
|
|
|
|
|
|
|
|
if (!values.isEmpty())
|
|
|
|
@ -744,8 +744,8 @@ TQString AlbumDB::getItemCaption(int albumID, const TQString& name)
|
|
|
|
|
|
|
|
|
|
execSql( TQString("SELECT caption FROM Images "
|
|
|
|
|
"WHERE dirid=%1 AND name='%2';")
|
|
|
|
|
.tqarg(albumID)
|
|
|
|
|
.tqarg(escapeString(name)),
|
|
|
|
|
.arg(albumID)
|
|
|
|
|
.arg(escapeString(name)),
|
|
|
|
|
&values );
|
|
|
|
|
|
|
|
|
|
if (!values.isEmpty())
|
|
|
|
@ -760,7 +760,7 @@ TQDateTime AlbumDB::getItemDate(TQ_LLONG imageID)
|
|
|
|
|
|
|
|
|
|
execSql( TQString("SELECT datetime FROM Images "
|
|
|
|
|
"WHERE id=%1;")
|
|
|
|
|
.tqarg(imageID),
|
|
|
|
|
.arg(imageID),
|
|
|
|
|
&values );
|
|
|
|
|
|
|
|
|
|
if (values.isEmpty())
|
|
|
|
@ -775,8 +775,8 @@ TQDateTime AlbumDB::getItemDate(int albumID, const TQString& name)
|
|
|
|
|
|
|
|
|
|
execSql( TQString("SELECT datetime FROM Images "
|
|
|
|
|
"WHERE dirid=%1 AND name='%2';")
|
|
|
|
|
.tqarg(albumID)
|
|
|
|
|
.tqarg(escapeString(name)),
|
|
|
|
|
.arg(albumID)
|
|
|
|
|
.arg(escapeString(name)),
|
|
|
|
|
&values );
|
|
|
|
|
|
|
|
|
|
if (values.isEmpty())
|
|
|
|
@ -791,8 +791,8 @@ TQ_LLONG AlbumDB::getImageId(int albumID, const TQString& name)
|
|
|
|
|
|
|
|
|
|
execSql( TQString("SELECT id FROM Images "
|
|
|
|
|
"WHERE dirid=%1 AND name='%2';")
|
|
|
|
|
.tqarg(albumID)
|
|
|
|
|
.tqarg(escapeString(name)),
|
|
|
|
|
.arg(albumID)
|
|
|
|
|
.arg(escapeString(name)),
|
|
|
|
|
&values );
|
|
|
|
|
|
|
|
|
|
if (values.isEmpty())
|
|
|
|
@ -809,7 +809,7 @@ TQStringList AlbumDB::getItemTagNames(TQ_LLONG imageID)
|
|
|
|
|
"WHERE id IN (SELECT tagid FROM ImageTags \n "
|
|
|
|
|
" WHERE imageid=%1) \n "
|
|
|
|
|
"ORDER BY name;")
|
|
|
|
|
.tqarg(imageID),
|
|
|
|
|
.arg(imageID),
|
|
|
|
|
&values );
|
|
|
|
|
|
|
|
|
|
return values;
|
|
|
|
@ -821,7 +821,7 @@ IntList AlbumDB::getItemTagIDs(TQ_LLONG imageID)
|
|
|
|
|
|
|
|
|
|
execSql( TQString("SELECT tagid FROM ImageTags \n "
|
|
|
|
|
"WHERE imageID=%1;")
|
|
|
|
|
.tqarg(imageID),
|
|
|
|
|
.arg(imageID),
|
|
|
|
|
&values );
|
|
|
|
|
|
|
|
|
|
IntList ids;
|
|
|
|
@ -847,7 +847,7 @@ bool AlbumDB::hasTags(const LLongList& imageIDList)
|
|
|
|
|
|
|
|
|
|
TQString sql = TQString("SELECT count(tagid) FROM ImageTags "
|
|
|
|
|
"WHERE imageid=%1 ")
|
|
|
|
|
.tqarg(imageIDList.first());
|
|
|
|
|
.arg(imageIDList.first());
|
|
|
|
|
|
|
|
|
|
LLongList::const_iterator iter = imageIDList.begin();
|
|
|
|
|
++iter;
|
|
|
|
@ -855,7 +855,7 @@ bool AlbumDB::hasTags(const LLongList& imageIDList)
|
|
|
|
|
while (iter != imageIDList.end())
|
|
|
|
|
{
|
|
|
|
|
sql += TQString(" OR imageid=%2 ")
|
|
|
|
|
.tqarg(*iter);
|
|
|
|
|
.arg(*iter);
|
|
|
|
|
++iter;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -879,7 +879,7 @@ IntList AlbumDB::getItemCommonTagIDs(const LLongList& imageIDList)
|
|
|
|
|
|
|
|
|
|
TQString sql = TQString("SELECT DISTINCT tagid FROM ImageTags "
|
|
|
|
|
"WHERE imageid=%1 ")
|
|
|
|
|
.tqarg(imageIDList.first());
|
|
|
|
|
.arg(imageIDList.first());
|
|
|
|
|
|
|
|
|
|
LLongList::const_iterator iter = imageIDList.begin();
|
|
|
|
|
++iter;
|
|
|
|
@ -887,7 +887,7 @@ IntList AlbumDB::getItemCommonTagIDs(const LLongList& imageIDList)
|
|
|
|
|
while (iter != imageIDList.end())
|
|
|
|
|
{
|
|
|
|
|
sql += TQString(" OR imageid=%2 ")
|
|
|
|
|
.tqarg(*iter);
|
|
|
|
|
.arg(*iter);
|
|
|
|
|
++iter;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -910,7 +910,7 @@ void AlbumDB::setItemCaption(TQ_LLONG imageID,const TQString& caption)
|
|
|
|
|
|
|
|
|
|
execSql( TQString("UPDATE Images SET caption='%1' "
|
|
|
|
|
"WHERE id=%2;")
|
|
|
|
|
.tqarg(escapeString(caption),
|
|
|
|
|
.arg(escapeString(caption),
|
|
|
|
|
TQString::number(imageID) ));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -920,7 +920,7 @@ void AlbumDB::setItemCaption(int albumID, const TQString& name, const TQString&
|
|
|
|
|
|
|
|
|
|
execSql( TQString("UPDATE Images SET caption='%1' "
|
|
|
|
|
"WHERE dirid=%2 AND name='%3';")
|
|
|
|
|
.tqarg(escapeString(caption),
|
|
|
|
|
.arg(escapeString(caption),
|
|
|
|
|
TQString::number(albumID),
|
|
|
|
|
escapeString(name)) );
|
|
|
|
|
}
|
|
|
|
@ -929,8 +929,8 @@ void AlbumDB::addItemTag(TQ_LLONG imageID, int tagID)
|
|
|
|
|
{
|
|
|
|
|
execSql( TQString("REPLACE INTO ImageTags (imageid, tagid) "
|
|
|
|
|
"VALUES(%1, %2);")
|
|
|
|
|
.tqarg(imageID)
|
|
|
|
|
.tqarg(tagID) );
|
|
|
|
|
.arg(imageID)
|
|
|
|
|
.arg(tagID) );
|
|
|
|
|
|
|
|
|
|
if (!d->recentlyAssignedTags.contains(tagID))
|
|
|
|
|
{
|
|
|
|
@ -945,9 +945,9 @@ void AlbumDB::addItemTag(int albumID, const TQString& name, int tagID)
|
|
|
|
|
execSql( TQString("REPLACE INTO ImageTags (imageid, tagid) \n "
|
|
|
|
|
"(SELECT id, %1 FROM Images \n "
|
|
|
|
|
" WHERE dirid=%2 AND name='%3');")
|
|
|
|
|
.tqarg(tagID)
|
|
|
|
|
.tqarg(albumID)
|
|
|
|
|
.tqarg(escapeString(name)) );
|
|
|
|
|
.arg(tagID)
|
|
|
|
|
.arg(albumID)
|
|
|
|
|
.arg(escapeString(name)) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IntList AlbumDB::getRecentlyAssignedTags() const
|
|
|
|
@ -959,15 +959,15 @@ void AlbumDB::removeItemTag(TQ_LLONG imageID, int tagID)
|
|
|
|
|
{
|
|
|
|
|
execSql( TQString("DELETE FROM ImageTags "
|
|
|
|
|
"WHERE imageID=%1 AND tagid=%2;")
|
|
|
|
|
.tqarg(imageID)
|
|
|
|
|
.tqarg(tagID) );
|
|
|
|
|
.arg(imageID)
|
|
|
|
|
.arg(tagID) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AlbumDB::removeItemAllTags(TQ_LLONG imageID)
|
|
|
|
|
{
|
|
|
|
|
execSql( TQString("DELETE FROM ImageTags "
|
|
|
|
|
"WHERE imageID=%1;")
|
|
|
|
|
.tqarg(imageID) );
|
|
|
|
|
.arg(imageID) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TQStringList AlbumDB::getItemNamesInAlbum(int albumID, bool recurssive)
|
|
|
|
@ -983,14 +983,14 @@ TQStringList AlbumDB::getItemNamesInAlbum(int albumID, bool recurssive)
|
|
|
|
|
"IN (SELECT DISTINCT id "
|
|
|
|
|
"FROM Albums "
|
|
|
|
|
"WHERE url='%1' OR url LIKE '\%%2\%')")
|
|
|
|
|
.tqarg(escapeString(url.path())).tqarg(escapeString(url.path(1))), &values);
|
|
|
|
|
.arg(escapeString(url.path())).arg(escapeString(url.path(1))), &values);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
execSql( TQString("SELECT Images.name "
|
|
|
|
|
"FROM Images "
|
|
|
|
|
"WHERE Images.dirid=%1")
|
|
|
|
|
.tqarg(albumID), &values );
|
|
|
|
|
.arg(albumID), &values );
|
|
|
|
|
}
|
|
|
|
|
return values;
|
|
|
|
|
}
|
|
|
|
@ -1019,14 +1019,14 @@ int AlbumDB::getOrCreateAlbumId(const TQString& folder)
|
|
|
|
|
{
|
|
|
|
|
TQStringList values;
|
|
|
|
|
execSql( TQString("SELECT id FROM Albums WHERE url ='%1';")
|
|
|
|
|
.tqarg( escapeString(folder) ), &values);
|
|
|
|
|
.arg( escapeString(folder) ), &values);
|
|
|
|
|
|
|
|
|
|
int albumID;
|
|
|
|
|
if (values.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
execSql( TQString ("INSERT INTO Albums (url, date) "
|
|
|
|
|
"VALUES ('%1','%2')")
|
|
|
|
|
.tqarg(escapeString(folder),
|
|
|
|
|
.arg(escapeString(folder),
|
|
|
|
|
TQDateTime::currentDateTime().toString(Qt::ISODate)) );
|
|
|
|
|
albumID = sqlite3_last_insert_rowid(d->dataBase);
|
|
|
|
|
} else
|
|
|
|
@ -1045,7 +1045,7 @@ TQ_LLONG AlbumDB::addItem(int albumID,
|
|
|
|
|
execSql ( TQString ("REPLACE INTO Images "
|
|
|
|
|
"( caption , datetime, name, dirid ) "
|
|
|
|
|
" VALUES ('%1','%2','%3',%4) " )
|
|
|
|
|
.tqarg(escapeString(comment),
|
|
|
|
|
.arg(escapeString(comment),
|
|
|
|
|
datetime.toString(Qt::ISODate),
|
|
|
|
|
escapeString(name),
|
|
|
|
|
TQString::number(albumID)) );
|
|
|
|
@ -1249,7 +1249,7 @@ int AlbumDB::getItemAlbum(TQ_LLONG imageID)
|
|
|
|
|
|
|
|
|
|
execSql ( TQString ("SELECT dirid FROM Images "
|
|
|
|
|
"WHERE id=%1;")
|
|
|
|
|
.tqarg(imageID),
|
|
|
|
|
.arg(imageID),
|
|
|
|
|
&values);
|
|
|
|
|
|
|
|
|
|
if (!values.isEmpty())
|
|
|
|
@ -1264,7 +1264,7 @@ TQString AlbumDB::getItemName(TQ_LLONG imageID)
|
|
|
|
|
|
|
|
|
|
execSql ( TQString ("SELECT name FROM Images "
|
|
|
|
|
"WHERE id=%1;")
|
|
|
|
|
.tqarg(imageID),
|
|
|
|
|
.arg(imageID),
|
|
|
|
|
&values);
|
|
|
|
|
|
|
|
|
|
if (!values.isEmpty())
|
|
|
|
@ -1278,7 +1278,7 @@ bool AlbumDB::setItemDate(TQ_LLONG imageID,
|
|
|
|
|
{
|
|
|
|
|
execSql ( TQString ("UPDATE Images SET datetime='%1'"
|
|
|
|
|
"WHERE id=%2;")
|
|
|
|
|
.tqarg(datetime.toString(Qt::ISODate),
|
|
|
|
|
.arg(datetime.toString(Qt::ISODate),
|
|
|
|
|
TQString::number(imageID)) );
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
@ -1289,7 +1289,7 @@ bool AlbumDB::setItemDate(int albumID, const TQString& name,
|
|
|
|
|
{
|
|
|
|
|
execSql ( TQString ("UPDATE Images SET datetime='%1'"
|
|
|
|
|
"WHERE dirid=%2 AND name='%3';")
|
|
|
|
|
.tqarg(datetime.toString(Qt::ISODate),
|
|
|
|
|
.arg(datetime.toString(Qt::ISODate),
|
|
|
|
|
TQString::number(albumID),
|
|
|
|
|
escapeString(name)) );
|
|
|
|
|
|
|
|
|
@ -1301,9 +1301,9 @@ void AlbumDB::setItemRating(TQ_LLONG imageID, int rating)
|
|
|
|
|
execSql ( TQString ("REPLACE INTO ImageProperties "
|
|
|
|
|
"(imageid, property, value) "
|
|
|
|
|
"VALUES(%1, '%2', '%3');")
|
|
|
|
|
.tqarg(imageID)
|
|
|
|
|
.tqarg("Rating")
|
|
|
|
|
.tqarg(rating) );
|
|
|
|
|
.arg(imageID)
|
|
|
|
|
.arg("Rating")
|
|
|
|
|
.arg(rating) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int AlbumDB::getItemRating(TQ_LLONG imageID)
|
|
|
|
@ -1312,8 +1312,8 @@ int AlbumDB::getItemRating(TQ_LLONG imageID)
|
|
|
|
|
|
|
|
|
|
execSql( TQString("SELECT value FROM ImageProperties "
|
|
|
|
|
"WHERE imageid=%1 and property='%2';")
|
|
|
|
|
.tqarg(imageID)
|
|
|
|
|
.tqarg("Rating"),
|
|
|
|
|
.arg(imageID)
|
|
|
|
|
.arg("Rating"),
|
|
|
|
|
&values);
|
|
|
|
|
|
|
|
|
|
if (!values.isEmpty())
|
|
|
|
@ -1337,7 +1337,7 @@ TQStringList AlbumDB::getItemURLsInAlbum(int albumID)
|
|
|
|
|
sqlString = TQString("SELECT Albums.url||'/'||Images.name FROM Images, Albums "
|
|
|
|
|
"WHERE Albums.id=%1 AND Albums.id=Images.dirid "
|
|
|
|
|
"ORDER BY Images.name COLLATE NOCASE;")
|
|
|
|
|
.tqarg(albumID);
|
|
|
|
|
.arg(albumID);
|
|
|
|
|
break;
|
|
|
|
|
case AlbumSettings::ByIPath:
|
|
|
|
|
// Dont collate on the path - this is to maintain the same behaviour
|
|
|
|
@ -1345,13 +1345,13 @@ TQStringList AlbumDB::getItemURLsInAlbum(int albumID)
|
|
|
|
|
sqlString = TQString("SELECT Albums.url||'/'||Images.name FROM Images, Albums "
|
|
|
|
|
"WHERE Albums.id=%1 AND Albums.id=Images.dirid "
|
|
|
|
|
"ORDER BY Albums.url,Images.name;")
|
|
|
|
|
.tqarg(albumID);
|
|
|
|
|
.arg(albumID);
|
|
|
|
|
break;
|
|
|
|
|
case AlbumSettings::ByIDate:
|
|
|
|
|
sqlString = TQString("SELECT Albums.url||'/'||Images.name FROM Images, Albums "
|
|
|
|
|
"WHERE Albums.id=%1 AND Albums.id=Images.dirid "
|
|
|
|
|
"ORDER BY Images.datetime;")
|
|
|
|
|
.tqarg(albumID);
|
|
|
|
|
.arg(albumID);
|
|
|
|
|
break;
|
|
|
|
|
case AlbumSettings::ByIRating:
|
|
|
|
|
sqlString = TQString("SELECT Albums.url||'/'||Images.name FROM Images, Albums, ImageProperties "
|
|
|
|
@ -1359,12 +1359,12 @@ TQStringList AlbumDB::getItemURLsInAlbum(int albumID)
|
|
|
|
|
"AND Images.id = ImageProperties.imageid "
|
|
|
|
|
"AND ImageProperties.property='Rating' "
|
|
|
|
|
"ORDER BY ImageProperties.value DESC;")
|
|
|
|
|
.tqarg(albumID);
|
|
|
|
|
.arg(albumID);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
sqlString = TQString("SELECT Albums.url||'/'||Images.name FROM Images, Albums "
|
|
|
|
|
"WHERE Albums.id=%1 AND Albums.id=Images.dirid;")
|
|
|
|
|
.tqarg(albumID);
|
|
|
|
|
.arg(albumID);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
execSql( sqlString, &values );
|
|
|
|
@ -1403,14 +1403,14 @@ TQStringList AlbumDB::getItemURLsInTag(int tagID, bool recursive)
|
|
|
|
|
imagesIdClause = TQString("SELECT imageid FROM ImageTags "
|
|
|
|
|
" WHERE tagid=%1 "
|
|
|
|
|
" OR tagid IN (SELECT id FROM TagsTree WHERE pid=%2)")
|
|
|
|
|
.tqarg(tagID).tqarg(tagID);
|
|
|
|
|
.arg(tagID).arg(tagID);
|
|
|
|
|
else
|
|
|
|
|
imagesIdClause = TQString("SELECT imageid FROM ImageTags WHERE tagid=%1").tqarg(tagID);
|
|
|
|
|
imagesIdClause = TQString("SELECT imageid FROM ImageTags WHERE tagid=%1").arg(tagID);
|
|
|
|
|
|
|
|
|
|
execSql( TQString("SELECT Albums.url||'/'||Images.name FROM Images, Albums "
|
|
|
|
|
"WHERE Images.id IN (%1) "
|
|
|
|
|
"AND Albums.id=Images.dirid;")
|
|
|
|
|
.tqarg(imagesIdClause), &values );
|
|
|
|
|
.arg(imagesIdClause), &values );
|
|
|
|
|
|
|
|
|
|
for (TQStringList::iterator it = values.begin(); it != values.end(); ++it)
|
|
|
|
|
{
|
|
|
|
@ -1429,10 +1429,10 @@ LLongList AlbumDB::getItemIDsInTag(int tagID, bool recursive)
|
|
|
|
|
execSql( TQString("SELECT imageid FROM ImageTags "
|
|
|
|
|
" WHERE tagid=%1 "
|
|
|
|
|
" OR tagid IN (SELECT id FROM TagsTree WHERE pid=%2)")
|
|
|
|
|
.tqarg(tagID).tqarg(tagID), &values );
|
|
|
|
|
.arg(tagID).arg(tagID), &values );
|
|
|
|
|
else
|
|
|
|
|
execSql( TQString("SELECT imageid FROM ImageTags WHERE tagid=%1;")
|
|
|
|
|
.tqarg(tagID), &values );
|
|
|
|
|
.arg(tagID), &values );
|
|
|
|
|
|
|
|
|
|
for (TQStringList::iterator it = values.begin(); it != values.end(); ++it)
|
|
|
|
|
{
|
|
|
|
@ -1446,7 +1446,7 @@ TQString AlbumDB::getAlbumURL(int albumID)
|
|
|
|
|
{
|
|
|
|
|
TQStringList values;
|
|
|
|
|
execSql( TQString("SELECT url from Albums where id=%1")
|
|
|
|
|
.tqarg( albumID), &values);
|
|
|
|
|
.arg( albumID), &values);
|
|
|
|
|
return values[0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1455,7 +1455,7 @@ TQDate AlbumDB::getAlbumLowestDate(int albumID)
|
|
|
|
|
TQStringList values;
|
|
|
|
|
execSql( TQString("SELECT MIN(datetime) FROM Images "
|
|
|
|
|
"WHERE dirid=%1 GROUP BY dirid")
|
|
|
|
|
.tqarg( albumID ), &values);
|
|
|
|
|
.arg( albumID ), &values);
|
|
|
|
|
TQDate itemDate = TQDate::fromString( values[0], Qt::ISODate );
|
|
|
|
|
return itemDate;
|
|
|
|
|
}
|
|
|
|
@ -1465,7 +1465,7 @@ TQDate AlbumDB::getAlbumHighestDate(int albumID)
|
|
|
|
|
TQStringList values;
|
|
|
|
|
execSql( TQString("SELECT MAX(datetime) FROM Images "
|
|
|
|
|
"WHERE dirid=%1 GROUP BY dirid")
|
|
|
|
|
.tqarg( albumID ), &values);
|
|
|
|
|
.arg( albumID ), &values);
|
|
|
|
|
TQDate itemDate = TQDate::fromString( values[0], Qt::ISODate );
|
|
|
|
|
return itemDate;
|
|
|
|
|
}
|
|
|
|
@ -1474,7 +1474,7 @@ TQDate AlbumDB::getAlbumAverageDate(int albumID)
|
|
|
|
|
{
|
|
|
|
|
TQStringList values;
|
|
|
|
|
execSql( TQString("SELECT datetime FROM Images WHERE dirid=%1")
|
|
|
|
|
.tqarg( albumID ), &values);
|
|
|
|
|
.arg( albumID ), &values);
|
|
|
|
|
|
|
|
|
|
int differenceInSecs = 0;
|
|
|
|
|
int amountOfImages = 0;
|
|
|
|
@ -1508,8 +1508,8 @@ void AlbumDB::deleteItem(int albumID, const TQString& file)
|
|
|
|
|
{
|
|
|
|
|
execSql( TQString("DELETE FROM Images "
|
|
|
|
|
"WHERE dirid=%1 AND name='%2';")
|
|
|
|
|
.tqarg(albumID)
|
|
|
|
|
.tqarg(escapeString(file)) );
|
|
|
|
|
.arg(albumID)
|
|
|
|
|
.arg(escapeString(file)) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AlbumDB::setAlbumURL(int albumID, const TQString& url)
|
|
|
|
@ -1518,17 +1518,17 @@ void AlbumDB::setAlbumURL(int albumID, const TQString& url)
|
|
|
|
|
|
|
|
|
|
// first delete any stale albums left behind
|
|
|
|
|
execSql( TQString("DELETE FROM Albums WHERE url = '%1'")
|
|
|
|
|
.tqarg(u) );
|
|
|
|
|
.arg(u) );
|
|
|
|
|
|
|
|
|
|
// now update the album url
|
|
|
|
|
execSql( TQString("UPDATE Albums SET url = '%1' WHERE id = %2;")
|
|
|
|
|
.tqarg(u, TQString::number(albumID) ));
|
|
|
|
|
.arg(u, TQString::number(albumID) ));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AlbumDB::setTagName(int tagID, const TQString& name)
|
|
|
|
|
{
|
|
|
|
|
execSql( TQString("UPDATE Tags SET name='%1' WHERE id=%2;")
|
|
|
|
|
.tqarg(escapeString(name), TQString::number(tagID) ));
|
|
|
|
|
.arg(escapeString(name), TQString::number(tagID) ));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AlbumDB::moveItem(int srcAlbumID, const TQString& srcName,
|
|
|
|
@ -1540,7 +1540,7 @@ void AlbumDB::moveItem(int srcAlbumID, const TQString& srcName,
|
|
|
|
|
|
|
|
|
|
execSql( TQString("UPDATE Images SET dirid=%1, name='%2' "
|
|
|
|
|
"WHERE dirid=%3 AND name='%4';")
|
|
|
|
|
.tqarg(TQString::number(dstAlbumID), escapeString(dstName),
|
|
|
|
|
.arg(TQString::number(dstAlbumID), escapeString(dstName),
|
|
|
|
|
TQString::number(srcAlbumID), escapeString(srcName)) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1555,7 +1555,7 @@ int AlbumDB::copyItem(int srcAlbumID, const TQString& srcName,
|
|
|
|
|
TQStringList values;
|
|
|
|
|
execSql( TQString("SELECT id FROM Images "
|
|
|
|
|
"WHERE dirid=%1 AND name='%2';")
|
|
|
|
|
.tqarg(TQString::number(srcAlbumID), escapeString(srcName)),
|
|
|
|
|
.arg(TQString::number(srcAlbumID), escapeString(srcName)),
|
|
|
|
|
&values);
|
|
|
|
|
|
|
|
|
|
if (values.isEmpty())
|
|
|
|
@ -1570,7 +1570,7 @@ int AlbumDB::copyItem(int srcAlbumID, const TQString& srcName,
|
|
|
|
|
execSql( TQString("INSERT INTO Images (dirid, name, caption, datetime) "
|
|
|
|
|
"SELECT %1, '%2', caption, datetime FROM Images "
|
|
|
|
|
"WHERE id=%3;")
|
|
|
|
|
.tqarg(TQString::number(dstAlbumID), escapeString(dstName),
|
|
|
|
|
.arg(TQString::number(dstAlbumID), escapeString(dstName),
|
|
|
|
|
TQString::number(srcId)) );
|
|
|
|
|
|
|
|
|
|
int dstId = sqlite3_last_insert_rowid(d->dataBase);
|
|
|
|
@ -1579,13 +1579,13 @@ int AlbumDB::copyItem(int srcAlbumID, const TQString& srcName,
|
|
|
|
|
execSql( TQString("INSERT INTO ImageTags (imageid, tagid) "
|
|
|
|
|
"SELECT %1, tagid FROM ImageTags "
|
|
|
|
|
"WHERE imageid=%2;")
|
|
|
|
|
.tqarg(TQString::number(dstId), TQString::number(srcId)) );
|
|
|
|
|
.arg(TQString::number(dstId), TQString::number(srcId)) );
|
|
|
|
|
|
|
|
|
|
// copy properties (rating)
|
|
|
|
|
execSql( TQString("INSERT INTO ImageProperties (imageid, property, value) "
|
|
|
|
|
"SELECT %1, property, value FROM ImageProperties "
|
|
|
|
|
"WHERE imageid=%2;")
|
|
|
|
|
.tqarg(TQString::number(dstId), TQString::number(srcId)) );
|
|
|
|
|
.arg(TQString::number(dstId), TQString::number(srcId)) );
|
|
|
|
|
|
|
|
|
|
return dstId;
|
|
|
|
|
}
|
|
|
|
|