diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-04-02 19:33:39 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-04-02 19:33:39 +0000 |
commit | 1fbeee4477a957c3c17a8b6473547fe5b063f273 (patch) | |
tree | efbc1b031b385fdb05bff715344c80e38061944e /konq-plugins/rsync/rsyncplugin.cpp | |
parent | 545e53fd4648ddbc95725225b025e94054001720 (diff) | |
download | tdeaddons-1fbeee4477a957c3c17a8b6473547fe5b063f273.tar.gz tdeaddons-1fbeee4477a957c3c17a8b6473547fe5b063f273.zip |
Cleanup and fixes
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeaddons@1110341 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'konq-plugins/rsync/rsyncplugin.cpp')
-rw-r--r-- | konq-plugins/rsync/rsyncplugin.cpp | 52 |
1 files changed, 25 insertions, 27 deletions
diff --git a/konq-plugins/rsync/rsyncplugin.cpp b/konq-plugins/rsync/rsyncplugin.cpp index 7b69b91..109c503 100644 --- a/konq-plugins/rsync/rsyncplugin.cpp +++ b/konq-plugins/rsync/rsyncplugin.cpp @@ -95,13 +95,16 @@ #include <kio/global.h> #include <kio/slavebase.h> -#include <kio/authinfo.h> #include "rsyncplugin.h" #include "rsyncconfigdialog.h" #define myDebug(x) kdDebug(7127) << __LINE__ << ": " x +typedef KGenericFactory<RsyncPlugin> RsyncPluginFactory; +K_EXPORT_COMPONENT_FACTORY(librsyncplugin, + RsyncPluginFactory("rsyncplugin")) + RsyncPlugin::RsyncPlugin (QObject* parent, const char* name, const QStringList&) :KParts::Plugin (parent, name), @@ -881,36 +884,34 @@ void RsyncPlugin::slotOpenURL () if (m_pURL != url) { - // See if this URL is in the list of rsync-able directories - if (findLocalFolderByName(url.directory(true, true) + QString("/") + url.fileName(true)) != NULL) { - m_pSyncNow->setEnabled (true); + // See if this URL is "/", "/dev", or "/proc", and disable sync if so + if ((url.directory(true, true) + QString("/") + url.fileName(true)) == "//") { + m_pSyncSetup->setEnabled(false); + m_pSyncNow->setEnabled(false); + } + else if (((url.directory(true, true) + QString("/") + url.fileName(true)).left(5) == "//dev") || ((url.directory(true, true) + QString("/") + url.fileName(true)).left(4) == "/dev")) { + m_pSyncSetup->setEnabled(false); + m_pSyncNow->setEnabled(false); + } + else if (((url.directory(true, true) + QString("/") + url.fileName(true)).left(6) == "//proc") || ((url.directory(true, true) + QString("/") + url.fileName(true)).left(5) == "/proc")) { + m_pSyncSetup->setEnabled(false); + m_pSyncNow->setEnabled(false); } else { - m_pSyncNow->setEnabled (false); + m_pSyncSetup->setEnabled(true); + + // See if this URL is in the list of rsync-able directories + if (findLocalFolderByName(url.directory(true, true) + QString("/") + url.fileName(true)) != NULL) { + m_pSyncNow->setEnabled (true); + } + else { + m_pSyncNow->setEnabled (false); + } } } m_pURL = url; } -// void RsyncPlugin::slotShowPopup() -// { -// if (!m_part) -// { -// m_pSyncMenu->setEnabled (false); -// return; -// } -// -// int id = 0; -// uint enableReset = 0; -// -// QString label; -// QStringList inodes; -// -// m_pSyncMenu->popupMenu()->clear(); -// m_pSyncMenu->popupMenu()->insertTitle (i18n("Remote Folder Synchronization")); -// id = m_pSyncMenu->popupMenu()->insertItem (i18n("Synchronize Now"), this, SLOT(slotSync())); -// } - void RsyncPlugin::slotSetup() { KURL url = m_part->url(); @@ -1036,7 +1037,4 @@ void RsyncPlugin::slotSync() m_pSyncNow->setEnabled (true); } -typedef KGenericFactory<RsyncPlugin> RsyncFactory; -K_EXPORT_COMPONENT_FACTORY (librsyncplugin, RsyncFactory("rsyncplugin")) - #include "rsyncplugin.moc" |