summaryrefslogtreecommitdiffstats
path: root/konq-plugins/rsync
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-04-02 19:33:39 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-04-02 19:33:39 +0000
commit1fbeee4477a957c3c17a8b6473547fe5b063f273 (patch)
treeefbc1b031b385fdb05bff715344c80e38061944e /konq-plugins/rsync
parent545e53fd4648ddbc95725225b025e94054001720 (diff)
downloadtdeaddons-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')
-rw-r--r--konq-plugins/rsync/Makefile.am8
-rw-r--r--konq-plugins/rsync/rsyncconfigdialog.h189
-rw-r--r--konq-plugins/rsync/rsyncplugin.cpp52
-rw-r--r--konq-plugins/rsync/rsyncplugin.h15
-rw-r--r--konq-plugins/rsync/rsyncplugin.rc14
5 files changed, 47 insertions, 231 deletions
diff --git a/konq-plugins/rsync/Makefile.am b/konq-plugins/rsync/Makefile.am
index 4f68035..ec2450a 100644
--- a/konq-plugins/rsync/Makefile.am
+++ b/konq-plugins/rsync/Makefile.am
@@ -1,19 +1,19 @@
-INCLUDES = $(all_includes)
+kde_module_LTLIBRARIES = librsyncplugin.la
+
+AM_CPPFLAGS = $(all_includes)
METASOURCES = AUTO
-kde_module_LTLIBRARIES = librsyncplugin.la
librsyncplugin_la_SOURCES = rsyncplugin.cpp rsyncconfigdialog.cpp
librsyncplugin_la_LIBADD = -lkonq
librsyncplugin_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
iconviewdir = $(kde_datadir)/konqiconview/kpartplugins
iconview_DATA = rsyncplugin.rc rsync_plugin.desktop
-
listviewdir = $(kde_datadir)/konqlistview/kpartplugins
listview_DATA = rsyncplugin.rc rsync_plugin.desktop
appsdir = $(kde_appsdir)/.hidden
-apps_DATA = rsyncplugin.desktop
+apps_DATA = rsyncplugin.desktop
KDE_ICON = AUTO
diff --git a/konq-plugins/rsync/rsyncconfigdialog.h b/konq-plugins/rsync/rsyncconfigdialog.h
index 9099ad3..38f8687 100644
--- a/konq-plugins/rsync/rsyncconfigdialog.h
+++ b/konq-plugins/rsync/rsyncconfigdialog.h
@@ -30,6 +30,10 @@
#include <klibloader.h>
#include <kdialogbase.h>
+// NOTE: If ANY of these functions are not utilized in the C file,
+// and in a manner identical to these declarations, the plugin will
+// mysteriously fail when launched with kshell but work fine under BASH
+
class RsyncConfigDialog : public KDialogBase
{
Q_OBJECT
@@ -42,29 +46,13 @@ class RsyncConfigDialog : public KDialogBase
const QString& remotefolder = QString::null,
int syncmode = 1, bool modal = false);
- ~RsyncConfigDialog() {}
-//
-// /**
-// * Returns the KProgressBox used in this dialog.
-// * To set the number of steps or other progress bar related
-// * settings, access the KProgressBox object directly via this method.
-// */
-// KProgress* progressBar();
-//
/**
* Returns the QLineEdit used in this dialog.
* To set the number of lines or other text box related
* settings, access the KTextEdit object directly via this method.
*/
QLineEdit* lineEdit();
-//
-// /**
-// * Returns the KProgressBox used in this dialog.
-// * To set the number of steps or other progress bar related
-// * settings, access the KProgressBox object directly via this method.
-// */
-// const KProgress* progressBar() const;
-//
+
/**
* Returns the QLineEdit used in this dialog.
* To set the number of lines or other text box related
@@ -73,117 +61,6 @@ class RsyncConfigDialog : public KDialogBase
const QLineEdit* lineEdit() const;
/**
- * Sets the text in the dialog
- *
- * @param text the text to display
- */
- void setLabel(const QString & text);
-
- /**
- * Returns the current dialog text
- * @deprecated
- */
- // ### Remove this KDE 4.0
- QString labelText() KDE_DEPRECATED;
-
- /**
- * Returns the current dialog text
- */
- QString labelText() const;
-
- /**
- * Sets whether or not the user can cancel the process.
- * If the dialog is cancellable, the Cancel button will be shown
- * and the user can close the window using the window decorations.
- * If the process is not (or should not be) interuptable,
- * set the dialog to be modal and not cancellable.
- *
- * @param allowCancel Set to true to make the dialog non-closable
- */
- void setAllowCancel(bool allowCancel);
-
- /**
- * Sets whether or not the user can edit the text shown in the textbox.
- *
- * @param allowTextEdit Set to true to make the text editable
- */
- void setAllowTextEdit(bool allowTextEdit);
-
- /**
- * Returns true if the dialog can be canceled, false otherwise
- * @deprecated
- */
- // ### Remove this KDE 4.0
- bool allowCancel() KDE_DEPRECATED;
-
- /**
- * Returns true if the dialog can be canceled, false otherwise
- */
- bool allowCancel() const;
-
- /**
- * Sets whether the cancel button is visible. setAllowCancel(false)
- * implies showCancelButton(false)
- *
- * @param show Whether or not the cancel button should be shown
- */
- void showCancelButton(bool show);
-//
-// /**
-// * Sets whether the dialog should close automagically when
-// * all the steps in the KProgressBox have been completed.
-// */
-// void setAutoClose(bool close);
-//
-// /**
-// * Returns true if the dialog will close upon completion,
-// * or false otherwise
-// */
-// // ### Remove this KDE 4.0
-// bool autoClose();
-//
-// /**
-// * Returns true if the dialog will close upon completion,
-// * or false otherwise
-// */
-// bool autoClose() const;
-//
-// /**
-// * Sets whether the dialog should reset the KProgressBox dialog
-// * back to 0 steps compelete when all steps have been completed.
-// * This is useful for RsyncConfigDialogs that will be reused.
-// */
-// void setAutoReset(bool autoReset);
-//
-// /**
-// * Returns true if the KProgressBox widget will be reset
-// * upon completion, or false otherwise
-// */
-// // ### Remove this KDE 4.0
-// bool autoReset();
-//
-// /**
-// * Returns true if the KProgressBox widget will be reset
-// * upon completion, or false otherwise
-// */
-// bool autoReset() const;
-//
- /**
- * Returns true if the dialog was closed or canceled
- * before completion. If the dialog is not cancellable
- * it will always return false.
- */
- // ### Remove this KDE 4.0
- bool wasCancelled();
-
- /**
- * Returns true if the dialog was closed or canceled
- * before completion. If the dialog is not cancellable
- * it will always return false.
- */
- bool wasCancelled() const;
-
- /**
* Returns index of selected synchronization mode
* 1: Upload
* 2: Download
@@ -191,61 +68,7 @@ class RsyncConfigDialog : public KDialogBase
*/
int getSyncMode();
- /**
- * Ignores the last cancel action if the cancel button was
- * pressed. Useful for kdialog when combined with a KMessageBox
- * to display a message like "Are you sure you want to cancel?"
- * @since 3.5.5
- */
- void ignoreCancel();
-
- /**
- * Sets the text to appear on the cancel button.
- */
- void setButtonText(const QString&);
-
- /**
- * Returns the text on the cancel button
- * @deprecated
- */
- // ### Remove this KDE 4.0
- QString buttonText() KDE_DEPRECATED;
-
- /**
- * Returns the text on the cancel button
- */
- QString buttonText() const;
-//
-// /**
-// * Set the minimum number of milliseconds to wait before
-// * actually showing the dialog
-// */
-// void setMinimumDuration(int ms);
-//
-// /**
-// * Returns the wait duration in milliseconds
-// * @deprecated
-// */
-// // ### Remove this KDE 4.0
-// int minimumDuration() KDE_DEPRECATED;
-//
-// /**
-// * Returns the wait duration in milliseconds
-// */
-// int minimumDuration() const;
-//
-// /**
-// * Reimplemented for internal reasons, the API is not affected.
-// */
-// virtual void show();
-//
-// protected slots:
-// void slotAutoShow();
-// void slotAutoActions(int percentage);
-// void slotCancel();
-//
private:
- // ### Move these member variables to d in KDE 4.0
bool mAutoClose;
bool mAutoReset;
bool mCancelled;
@@ -261,7 +84,5 @@ class RsyncConfigDialog : public KDialogBase
QRadioButton *rsync_rb1;
QRadioButton *rsync_rb2;
QRadioButton *rsync_rb3;
-// protected:
-// virtual void virtual_hook( int id, void* data );
};
#endif
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"
diff --git a/konq-plugins/rsync/rsyncplugin.h b/konq-plugins/rsync/rsyncplugin.h
index 86aa17f..96a3caa 100644
--- a/konq-plugins/rsync/rsyncplugin.h
+++ b/konq-plugins/rsync/rsyncplugin.h
@@ -29,25 +29,22 @@
#include <kparts/plugin.h>
#include <kio/global.h>
#include <kio/slavebase.h>
-#include <kio/authinfo.h>
#include "rsyncconfigdialog.h"
+// NOTE: If ANY of these functions are not utilized in the C file,
+// and in a manner identical to these declarations, the plugin will
+// mysteriously fail when launched with kshell but work fine under BASH
+
class KActionMenu;
class KonqDirPart;
class KLineEdit;
-
namespace KParts
{
struct URLArgs;
}
-namespace KIO
-{
- class Job;
-}
-
class RsyncPlugin : public KParts::Plugin
{
Q_OBJECT
@@ -55,7 +52,7 @@ class RsyncPlugin : public KParts::Plugin
public:
RsyncPlugin (QObject* parent, const char* name, const QStringList &);
- ~RsyncPlugin ();
+ virtual ~RsyncPlugin();
protected:
void loadSettings();
@@ -87,7 +84,6 @@ private slots:
void slotSync();
void slotSetup();
void slotOpenURL();
- void slotShowPopup();
void slotSetupOK();
void slotSetupCancelled();
void slotRsyncCancelled();
@@ -98,7 +94,6 @@ private:
KonqDirPart* m_part;
KAction* m_pSyncNow;
KAction* m_pSyncSetup;
- KActionMenu* m_pSyncMenu;
KProgressBoxDialog* m_progressDialog;
RsyncConfigDialog* m_configDialog;
diff --git a/konq-plugins/rsync/rsyncplugin.rc b/konq-plugins/rsync/rsyncplugin.rc
index 40ec020..dc5cc7c 100644
--- a/konq-plugins/rsync/rsyncplugin.rc
+++ b/konq-plugins/rsync/rsyncplugin.rc
@@ -1,7 +1,9 @@
<!DOCTYPE kpartplugin>
-<kpartplugin name="RsyncPlugin" library="librsyncplugin" version = "4">
-<ToolBar fullWidth="true" name="locationToolBar" newline="true">
- <Action name="syncnow"/>
- <Action name="setupsync"/>
-</ToolBar>
-</kpartplugin>
+<kpartplugin library="librsyncplugin" version="4" name="RsyncPlugin" >
+ <ToolBar newline="true" noMerge="1" name="locationToolBar" fullWidth="true" >
+ <text>Rsync Toolbar</text>
+ <Separator lineSeparator="false" name="separator_0" />
+ <Action name="syncnow"/>
+ <Action name="setupsync"/>
+ </ToolBar>
+</kpartplugin> \ No newline at end of file