diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-04-09 17:32:28 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-04-09 17:32:28 +0000 |
commit | 8237db40749f6affe01cc1de87465ea11d1d9107 (patch) | |
tree | a931f67ef3d7c89c20de6a05d3fd740cbeedc5a8 /konq-plugins | |
parent | 1fbeee4477a957c3c17a8b6473547fe5b063f273 (diff) | |
download | tdeaddons-8237db40749f6affe01cc1de87465ea11d1d9107.tar.gz tdeaddons-8237db40749f6affe01cc1de87465ea11d1d9107.zip |
Polished UI and extended backed slightly for rsync Konqueror plugin
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeaddons@1113004 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'konq-plugins')
-rw-r--r-- | konq-plugins/rsync/rsyncplugin.cpp | 79 | ||||
-rw-r--r-- | konq-plugins/rsync/rsyncplugin.h | 5 |
2 files changed, 81 insertions, 3 deletions
diff --git a/konq-plugins/rsync/rsyncplugin.cpp b/konq-plugins/rsync/rsyncplugin.cpp index 109c503..3c4ae1a 100644 --- a/konq-plugins/rsync/rsyncplugin.cpp +++ b/konq-plugins/rsync/rsyncplugin.cpp @@ -73,6 +73,7 @@ #include <kinstance.h> #include <kwin.h> +#include <kurl.h> #include <kaction.h> #include <kpopupmenu.h> #include <kmessagebox.h> @@ -828,6 +829,9 @@ QString RsyncPlugin::findLocalFolderByName(QString folderurl) return (*i); i++; i++; + i++; + i++; + i++; } } return NULL; @@ -844,6 +848,66 @@ QString RsyncPlugin::findSyncMethodByName(QString folderurl) i++; return (*i); i++; + i++; + i++; + i++; + } + } + return NULL; +} + +QString RsyncPlugin::findLoginSyncEnabledByName(QString folderurl) +{ + QString folderurl_stripped; + folderurl_stripped = folderurl; + folderurl_stripped.replace(QString("file://"), QString("")); + for (QStringList::Iterator i(cfgfolderlist.begin()); i != cfgfolderlist.end(); ++i) { + if (QString::compare((*i), folderurl_stripped) == 0) { + i++; + i++; + i++; + i++; + return (*i); + i++; + i++; + } + } + return NULL; +} + +QString RsyncPlugin::findLogoutSyncEnabledByName(QString folderurl) +{ + QString folderurl_stripped; + folderurl_stripped = folderurl; + folderurl_stripped.replace(QString("file://"), QString("")); + for (QStringList::Iterator i(cfgfolderlist.begin()); i != cfgfolderlist.end(); ++i) { + if (QString::compare((*i), folderurl_stripped) == 0) { + i++; + i++; + i++; + i++; + i++; + return (*i); + i++; + } + } + return NULL; +} + +QString RsyncPlugin::findTimedSyncEnabledByName(QString folderurl) +{ + QString folderurl_stripped; + folderurl_stripped = folderurl; + folderurl_stripped.replace(QString("file://"), QString("")); + for (QStringList::Iterator i(cfgfolderlist.begin()); i != cfgfolderlist.end(); ++i) { + if (QString::compare((*i), folderurl_stripped) == 0) { + i++; + i++; + i++; + i++; + i++; + i++; + return (*i); } } return NULL; @@ -859,6 +923,9 @@ int RsyncPlugin::deleteLocalFolderByName(QString folderurl) i=cfgfolderlist.remove(i); i=cfgfolderlist.remove(i); i=cfgfolderlist.remove(i); + i=cfgfolderlist.remove(i); + i=cfgfolderlist.remove(i); + i=cfgfolderlist.remove(i); cfgfolderlist.remove(i); return 0; } @@ -866,7 +933,7 @@ int RsyncPlugin::deleteLocalFolderByName(QString folderurl) return 1; } -int RsyncPlugin::addLocalFolderByName(QString folderurl, QString remoteurl, QString syncmethod, QString excludelist) +int RsyncPlugin::addLocalFolderByName(QString folderurl, QString remoteurl, QString syncmethod, QString excludelist, QString sync_on_login, QString sync_on_logout, QString sync_timed_interval) { QString folderurl_stripped; folderurl_stripped = folderurl; @@ -875,6 +942,9 @@ int RsyncPlugin::addLocalFolderByName(QString folderurl, QString remoteurl, QStr cfgfolderlist.append(remoteurl); cfgfolderlist.append(syncmethod); cfgfolderlist.append(excludelist); + cfgfolderlist.append(sync_on_login); + cfgfolderlist.append(sync_on_logout); + cfgfolderlist.append(sync_timed_interval); return 1; } @@ -885,6 +955,7 @@ void RsyncPlugin::slotOpenURL () if (m_pURL != url) { // See if this URL is "/", "/dev", or "/proc", and disable sync if so + // Also disable sync for non-"file://" URLs if ((url.directory(true, true) + QString("/") + url.fileName(true)) == "//") { m_pSyncSetup->setEnabled(false); m_pSyncNow->setEnabled(false); @@ -897,6 +968,10 @@ void RsyncPlugin::slotOpenURL () m_pSyncSetup->setEnabled(false); m_pSyncNow->setEnabled(false); } + else if (url.protocol() != QString("file")) { + m_pSyncSetup->setEnabled(false); + m_pSyncNow->setEnabled(false); + } else { m_pSyncSetup->setEnabled(true); @@ -971,7 +1046,7 @@ void RsyncPlugin::slotSetupOK() deleteLocalFolderByName(localfolder); } if (remotefolder_new.isEmpty() == false) { - addLocalFolderByName(localfolder, remotefolder_new, syncmethod_new, ""); + addLocalFolderByName(localfolder, remotefolder_new, syncmethod_new, "", "0", "0", "-1"); } saveSettings(); diff --git a/konq-plugins/rsync/rsyncplugin.h b/konq-plugins/rsync/rsyncplugin.h index 96a3caa..67af3d5 100644 --- a/konq-plugins/rsync/rsyncplugin.h +++ b/konq-plugins/rsync/rsyncplugin.h @@ -58,8 +58,11 @@ protected: void loadSettings(); void saveSettings(); QString findLocalFolderByName(QString folderurl); + QString findLoginSyncEnabledByName(QString folderurl); + QString findLogoutSyncEnabledByName(QString folderurl); + QString findTimedSyncEnabledByName(QString folderurl); int deleteLocalFolderByName(QString folderurl); - int addLocalFolderByName(QString folderurl, QString remoteurl, QString syncmethod, QString excludelist); + int addLocalFolderByName(QString folderurl, QString remoteurl, QString syncmethod, QString excludelist, QString sync_on_login, QString sync_on_logout, QString sync_timed_interval); QString findSyncMethodByName(QString folderurl); /** manages initial communication setup including password queries */ int establishConnectionRsync(char *buffer, KIO::fileoffset_t len); |