diff options
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" |