|
|
@ -86,13 +86,13 @@ extern "C"
|
|
|
|
#include "digikam_export.h"
|
|
|
|
#include "digikam_export.h"
|
|
|
|
#include "digikamalbums.h"
|
|
|
|
#include "digikamalbums.h"
|
|
|
|
|
|
|
|
|
|
|
|
kio_digikamalbums::kio_digikamalbums(const TQCString &pool_socket,
|
|
|
|
tdeio_digikamalbums::tdeio_digikamalbums(const TQCString &pool_socket,
|
|
|
|
const TQCString &app_socket)
|
|
|
|
const TQCString &app_socket)
|
|
|
|
: SlaveBase("kio_digikamalbums", pool_socket, app_socket)
|
|
|
|
: SlaveBase("tdeio_digikamalbums", pool_socket, app_socket)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
kio_digikamalbums::~kio_digikamalbums()
|
|
|
|
tdeio_digikamalbums::~tdeio_digikamalbums()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -128,7 +128,7 @@ static bool matchFilterList( const TQValueList<TQRegExp>& filters,
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void kio_digikamalbums::special(const TQByteArray& data)
|
|
|
|
void tdeio_digikamalbums::special(const TQByteArray& data)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
bool folders = (metaData("folders") == "yes");
|
|
|
|
bool folders = (metaData("folders") == "yes");
|
|
|
|
|
|
|
|
|
|
|
@ -369,7 +369,7 @@ static int write_all(int fd, const char *buf, size_t len)
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void kio_digikamalbums::get( const KURL& url )
|
|
|
|
void tdeio_digikamalbums::get( const KURL& url )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Code duplication from file:// ioslave
|
|
|
|
// Code duplication from file:// ioslave
|
|
|
|
kdDebug() << k_funcinfo << " : " << url << endl;
|
|
|
|
kdDebug() << k_funcinfo << " : " << url << endl;
|
|
|
@ -455,7 +455,7 @@ void kio_digikamalbums::get( const KURL& url )
|
|
|
|
finished();
|
|
|
|
finished();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void kio_digikamalbums::put(const KURL& url, int permissions, bool overwrite, bool /*resume*/)
|
|
|
|
void tdeio_digikamalbums::put(const KURL& url, int permissions, bool overwrite, bool /*resume*/)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Code duplication from file:// ioslave
|
|
|
|
// Code duplication from file:// ioslave
|
|
|
|
kdDebug() << k_funcinfo << " : " << url.url() << endl;
|
|
|
|
kdDebug() << k_funcinfo << " : " << url.url() << endl;
|
|
|
@ -609,7 +609,7 @@ void kio_digikamalbums::put(const KURL& url, int permissions, bool overwrite, bo
|
|
|
|
finished();
|
|
|
|
finished();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void kio_digikamalbums::copy( const KURL &src, const KURL &dst, int mode, bool overwrite )
|
|
|
|
void tdeio_digikamalbums::copy( const KURL &src, const KURL &dst, int mode, bool overwrite )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Code duplication from file:// ioslave?
|
|
|
|
// Code duplication from file:// ioslave?
|
|
|
|
kdDebug() << k_funcinfo << "Src: " << src.path() << ", Dst: " << dst.path() << endl;
|
|
|
|
kdDebug() << k_funcinfo << "Src: " << src.path() << ", Dst: " << dst.path() << endl;
|
|
|
@ -854,7 +854,7 @@ void kio_digikamalbums::copy( const KURL &src, const KURL &dst, int mode, bool o
|
|
|
|
finished();
|
|
|
|
finished();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void kio_digikamalbums::rename( const KURL& src, const KURL& dst, bool overwrite )
|
|
|
|
void tdeio_digikamalbums::rename( const KURL& src, const KURL& dst, bool overwrite )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Code duplication from file:// ioslave?
|
|
|
|
// Code duplication from file:// ioslave?
|
|
|
|
kdDebug() << k_funcinfo << "Src: " << src << ", Dst: " << dst << endl;
|
|
|
|
kdDebug() << k_funcinfo << "Src: " << src << ", Dst: " << dst << endl;
|
|
|
@ -1005,7 +1005,7 @@ void kio_digikamalbums::rename( const KURL& src, const KURL& dst, bool overwrite
|
|
|
|
finished();
|
|
|
|
finished();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void kio_digikamalbums::stat( const KURL& url )
|
|
|
|
void tdeio_digikamalbums::stat( const KURL& url )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQString libraryPath = url.user();
|
|
|
|
TQString libraryPath = url.user();
|
|
|
|
if (libraryPath.isEmpty())
|
|
|
|
if (libraryPath.isEmpty())
|
|
|
@ -1025,7 +1025,7 @@ void kio_digikamalbums::stat( const KURL& url )
|
|
|
|
finished();
|
|
|
|
finished();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void kio_digikamalbums::listDir( const KURL& url )
|
|
|
|
void tdeio_digikamalbums::listDir( const KURL& url )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Code duplication from file:// ioslave?
|
|
|
|
// Code duplication from file:// ioslave?
|
|
|
|
kdDebug() << k_funcinfo << " : " << url.path() << endl;
|
|
|
|
kdDebug() << k_funcinfo << " : " << url.path() << endl;
|
|
|
@ -1075,7 +1075,7 @@ void kio_digikamalbums::listDir( const KURL& url )
|
|
|
|
finished();
|
|
|
|
finished();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void kio_digikamalbums::mkdir( const KURL& url, int permissions )
|
|
|
|
void tdeio_digikamalbums::mkdir( const KURL& url, int permissions )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Code duplication from file:// ioslave?
|
|
|
|
// Code duplication from file:// ioslave?
|
|
|
|
kdDebug() << k_funcinfo << " : " << url.url() << endl;
|
|
|
|
kdDebug() << k_funcinfo << " : " << url.url() << endl;
|
|
|
@ -1148,7 +1148,7 @@ void kio_digikamalbums::mkdir( const KURL& url, int permissions )
|
|
|
|
error( TDEIO::ERR_FILE_ALREADY_EXIST, path );
|
|
|
|
error( TDEIO::ERR_FILE_ALREADY_EXIST, path );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void kio_digikamalbums::chmod( const KURL& url, int permissions )
|
|
|
|
void tdeio_digikamalbums::chmod( const KURL& url, int permissions )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Code duplication from file:// ioslave?
|
|
|
|
// Code duplication from file:// ioslave?
|
|
|
|
kdDebug() << k_funcinfo << " : " << url.url() << endl;
|
|
|
|
kdDebug() << k_funcinfo << " : " << url.url() << endl;
|
|
|
@ -1168,7 +1168,7 @@ void kio_digikamalbums::chmod( const KURL& url, int permissions )
|
|
|
|
finished();
|
|
|
|
finished();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void kio_digikamalbums::del( const KURL& url, bool isfile)
|
|
|
|
void tdeio_digikamalbums::del( const KURL& url, bool isfile)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Code duplication from file:// ioslave?
|
|
|
|
// Code duplication from file:// ioslave?
|
|
|
|
kdDebug() << k_funcinfo << " : " << url.url() << endl;
|
|
|
|
kdDebug() << k_funcinfo << " : " << url.url() << endl;
|
|
|
@ -1267,7 +1267,7 @@ void kio_digikamalbums::del( const KURL& url, bool isfile)
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool kio_digikamalbums::createUDSEntry(const TQString& path, TDEIO::UDSEntry& entry)
|
|
|
|
bool tdeio_digikamalbums::createUDSEntry(const TQString& path, TDEIO::UDSEntry& entry)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
entry.clear();
|
|
|
|
entry.clear();
|
|
|
|
|
|
|
|
|
|
|
@ -1317,7 +1317,7 @@ bool kio_digikamalbums::createUDSEntry(const TQString& path, TDEIO::UDSEntry& en
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void kio_digikamalbums::createDigikamPropsUDSEntry(TDEIO::UDSEntry& entry)
|
|
|
|
void tdeio_digikamalbums::createDigikamPropsUDSEntry(TDEIO::UDSEntry& entry)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
entry.clear();
|
|
|
|
entry.clear();
|
|
|
|
|
|
|
|
|
|
|
@ -1348,7 +1348,7 @@ void kio_digikamalbums::createDigikamPropsUDSEntry(TDEIO::UDSEntry& entry)
|
|
|
|
entry.append(atom);
|
|
|
|
entry.append(atom);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void kio_digikamalbums::buildAlbumList()
|
|
|
|
void tdeio_digikamalbums::buildAlbumList()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// simplified from AlbumDB::scanAlbums()
|
|
|
|
// simplified from AlbumDB::scanAlbums()
|
|
|
|
m_albumList.clear();
|
|
|
|
m_albumList.clear();
|
|
|
@ -1378,7 +1378,7 @@ void kio_digikamalbums::buildAlbumList()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
AlbumInfo kio_digikamalbums::findAlbum(const TQString& url, bool addIfNotExists)
|
|
|
|
AlbumInfo tdeio_digikamalbums::findAlbum(const TQString& url, bool addIfNotExists)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// similar to AlbumDB::getOrCreateAlbumId
|
|
|
|
// similar to AlbumDB::getOrCreateAlbumId
|
|
|
|
AlbumInfo album;
|
|
|
|
AlbumInfo album;
|
|
|
@ -1416,14 +1416,14 @@ AlbumInfo kio_digikamalbums::findAlbum(const TQString& url, bool addIfNotExists)
|
|
|
|
return album;
|
|
|
|
return album;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void kio_digikamalbums::delAlbum(int albumID)
|
|
|
|
void tdeio_digikamalbums::delAlbum(int albumID)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// code duplication from AlbumDB::deleteAlbum
|
|
|
|
// code duplication from AlbumDB::deleteAlbum
|
|
|
|
m_sqlDB.execSql(TQString("DELETE FROM Albums WHERE id='%1'")
|
|
|
|
m_sqlDB.execSql(TQString("DELETE FROM Albums WHERE id='%1'")
|
|
|
|
.arg(albumID));
|
|
|
|
.arg(albumID));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void kio_digikamalbums::renameAlbum(const TQString& oldURL, const TQString& newURL)
|
|
|
|
void tdeio_digikamalbums::renameAlbum(const TQString& oldURL, const TQString& newURL)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// similar to AlbumDB::setAlbumURL, but why more extended?
|
|
|
|
// similar to AlbumDB::setAlbumURL, but why more extended?
|
|
|
|
// first update the url of the album which was renamed
|
|
|
|
// first update the url of the album which was renamed
|
|
|
@ -1449,7 +1449,7 @@ void kio_digikamalbums::renameAlbum(const TQString& oldURL, const TQString& newU
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool kio_digikamalbums::findImage(int albumID, const TQString& name) const
|
|
|
|
bool tdeio_digikamalbums::findImage(int albumID, const TQString& name) const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// no similar method in AlbumDB?
|
|
|
|
// no similar method in AlbumDB?
|
|
|
|
TQStringList values;
|
|
|
|
TQStringList values;
|
|
|
@ -1476,7 +1476,7 @@ public:
|
|
|
|
TQString icon;
|
|
|
|
TQString icon;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
void kio_digikamalbums::addImage(int albumID, const TQString& filePath)
|
|
|
|
void tdeio_digikamalbums::addImage(int albumID, const TQString& filePath)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Code duplication: ScanLib::storeItemInDatabase, AlbumDB::addItem,
|
|
|
|
// Code duplication: ScanLib::storeItemInDatabase, AlbumDB::addItem,
|
|
|
|
// AlbumDB::setItemRating, AlbumDB::addItemTag, AlbumDB::addTag
|
|
|
|
// AlbumDB::setItemRating, AlbumDB::addItemTag, AlbumDB::addTag
|
|
|
@ -1714,7 +1714,7 @@ void kio_digikamalbums::addImage(int albumID, const TQString& filePath)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void kio_digikamalbums::delImage(int albumID, const TQString& name)
|
|
|
|
void tdeio_digikamalbums::delImage(int albumID, const TQString& name)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// code duplication from AlbumDB::deleteItem
|
|
|
|
// code duplication from AlbumDB::deleteItem
|
|
|
|
m_sqlDB.execSql( TQString("DELETE FROM Images "
|
|
|
|
m_sqlDB.execSql( TQString("DELETE FROM Images "
|
|
|
@ -1723,7 +1723,7 @@ void kio_digikamalbums::delImage(int albumID, const TQString& name)
|
|
|
|
.arg(escapeString(name)) );
|
|
|
|
.arg(escapeString(name)) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void kio_digikamalbums::renameImage(int oldAlbumID, const TQString& oldName,
|
|
|
|
void tdeio_digikamalbums::renameImage(int oldAlbumID, const TQString& oldName,
|
|
|
|
int newAlbumID, const TQString& newName)
|
|
|
|
int newAlbumID, const TQString& newName)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// code duplication from AlbumDB::deleteItem, AlbumDB::moveItem
|
|
|
|
// code duplication from AlbumDB::deleteItem, AlbumDB::moveItem
|
|
|
@ -1742,7 +1742,7 @@ void kio_digikamalbums::renameImage(int oldAlbumID, const TQString& oldName,
|
|
|
|
escapeString(oldName)) );
|
|
|
|
escapeString(oldName)) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void kio_digikamalbums::copyImage(int srcAlbumID, const TQString& srcName,
|
|
|
|
void tdeio_digikamalbums::copyImage(int srcAlbumID, const TQString& srcName,
|
|
|
|
int dstAlbumID, const TQString& dstName)
|
|
|
|
int dstAlbumID, const TQString& dstName)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// code duplication from AlbumDB::copyItem
|
|
|
|
// code duplication from AlbumDB::copyItem
|
|
|
@ -1796,13 +1796,13 @@ void kio_digikamalbums::copyImage(int srcAlbumID, const TQString& srcName,
|
|
|
|
.arg(TQString::number(dstId), TQString::number(srcId)) );
|
|
|
|
.arg(TQString::number(dstId), TQString::number(srcId)) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void kio_digikamalbums::scanAlbum(const TQString& url)
|
|
|
|
void tdeio_digikamalbums::scanAlbum(const TQString& url)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
scanOneAlbum(url);
|
|
|
|
scanOneAlbum(url);
|
|
|
|
removeInvalidAlbums();
|
|
|
|
removeInvalidAlbums();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void kio_digikamalbums::scanOneAlbum(const TQString& url)
|
|
|
|
void tdeio_digikamalbums::scanOneAlbum(const TQString& url)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQDir dir(m_libraryPath + url);
|
|
|
|
TQDir dir(m_libraryPath + url);
|
|
|
|
if (!dir.exists() || !dir.isReadable())
|
|
|
|
if (!dir.exists() || !dir.isReadable())
|
|
|
@ -1920,7 +1920,7 @@ void kio_digikamalbums::scanOneAlbum(const TQString& url)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void kio_digikamalbums::removeInvalidAlbums()
|
|
|
|
void tdeio_digikamalbums::removeInvalidAlbums()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQStringList urlList;
|
|
|
|
TQStringList urlList;
|
|
|
|
|
|
|
|
|
|
|
@ -1952,16 +1952,16 @@ extern "C"
|
|
|
|
DIGIKAM_EXPORT int kdemain(int argc, char **argv)
|
|
|
|
DIGIKAM_EXPORT int kdemain(int argc, char **argv)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
KLocale::setMainCatalogue("digikam");
|
|
|
|
KLocale::setMainCatalogue("digikam");
|
|
|
|
TDEInstance instance( "kio_digikamalbums" );
|
|
|
|
TDEInstance instance( "tdeio_digikamalbums" );
|
|
|
|
TDEGlobal::locale();
|
|
|
|
TDEGlobal::locale();
|
|
|
|
|
|
|
|
|
|
|
|
if (argc != 4) {
|
|
|
|
if (argc != 4) {
|
|
|
|
kdDebug() << "Usage: kio_digikamalbums protocol domain-socket1 domain-socket2"
|
|
|
|
kdDebug() << "Usage: tdeio_digikamalbums protocol domain-socket1 domain-socket2"
|
|
|
|
<< endl;
|
|
|
|
<< endl;
|
|
|
|
exit(-1);
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
kio_digikamalbums slave(argv[2], argv[3]);
|
|
|
|
tdeio_digikamalbums slave(argv[2], argv[3]);
|
|
|
|
slave.dispatchLoop();
|
|
|
|
slave.dispatchLoop();
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|