diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-18 17:00:31 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-18 17:00:31 +0000 |
commit | 395a904bff7b4d6ead445c342f7ac0c5fbf29121 (patch) | |
tree | 9829cadb79d2cc7c29a940627fadb28b11e54150 /konq-plugins/rsync | |
parent | 399f47c376fdf4d19192732a701ea9578d11619d (diff) | |
download | tdeaddons-395a904bff7b4d6ead445c342f7ac0c5fbf29121.tar.gz tdeaddons-395a904bff7b4d6ead445c342f7ac0c5fbf29121.zip |
TQt4 port kdeaddons
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeaddons@1237404 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'konq-plugins/rsync')
-rw-r--r-- | konq-plugins/rsync/rsyncconfigdialog.cpp | 34 | ||||
-rw-r--r-- | konq-plugins/rsync/rsyncconfigdialog.h | 11 | ||||
-rw-r--r-- | konq-plugins/rsync/rsyncplugin.cpp | 78 | ||||
-rw-r--r-- | konq-plugins/rsync/rsyncplugin.h | 3 |
4 files changed, 64 insertions, 62 deletions
diff --git a/konq-plugins/rsync/rsyncconfigdialog.cpp b/konq-plugins/rsync/rsyncconfigdialog.cpp index ae89efa..f0e99a4 100644 --- a/konq-plugins/rsync/rsyncconfigdialog.cpp +++ b/konq-plugins/rsync/rsyncconfigdialog.cpp @@ -100,12 +100,12 @@ /* * RsyncConfigDialog implementation */ -RsyncConfigDialog::RsyncConfigDialog(TQWidget* parent, const char* name, +RsyncConfigDialog::RsyncConfigDialog(TQWidget* tqparent, const char* name, const TQString& caption, const TQString& text, const TQString& localfolder, const TQString& remotefolder, int syncmode, bool modal) : KDialogBase(KDialogBase::Plain, caption, KDialogBase::Cancel | KDialogBase::Ok, - KDialogBase::Ok, parent, name, modal), + KDialogBase::Ok, tqparent, name, modal), mAutoClose(true), mAutoReset(false), mCancelled(false), @@ -113,7 +113,7 @@ RsyncConfigDialog::RsyncConfigDialog(TQWidget* parent, const char* name, mAllowTextEdit(false), mShown(false) { -#ifdef Q_WS_X11 +#ifdef TQ_WS_X11 KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon()); #endif mShowTimer = new TQTimer(this); @@ -122,19 +122,19 @@ RsyncConfigDialog::RsyncConfigDialog(TQWidget* parent, const char* name, mCancelText = actionButton(KDialogBase::Cancel)->text(); TQFrame* mainWidget = plainPage(); - TQVBoxLayout* layout = new TQVBoxLayout(mainWidget, 10); + TQVBoxLayout* tqlayout = new TQVBoxLayout(mainWidget, 10); mLabel = new TQLabel(TQString("<b>") + text + TQString("</b><br>")+i18n("Setting up synchronization for local folder")+TQString("<br><i>") + localfolder, mainWidget); - layout->addWidget(mLabel); + tqlayout->addWidget(mLabel); // Create an exclusive button group - TQButtonGroup *layoutg = new TQButtonGroup( 1, TQGroupBox::Horizontal, i18n("Synchronization Method")+TQString(":"), mainWidget); - layout->addWidget( layoutg ); - layoutg->setExclusive( TRUE ); + TQButtonGroup *tqlayoutg = new TQButtonGroup( 1, Qt::Horizontal, i18n("Synchronization Method")+TQString(":"), mainWidget); + tqlayout->addWidget( tqlayoutg ); + tqlayoutg->setExclusive( TRUE ); // Insert radiobuttons - rsync_rb1 = new TQRadioButton(i18n("&Utilize rsync + ssh for upload to remote server\nExample: servername:/path/to/remote/folder"), layoutg); - rsync_rb2 = new TQRadioButton(i18n("&Utilize rsync + ssh for download from remote server\nExample: servername:/path/to/remote/folder"), layoutg); - rsync_rb3 = new TQRadioButton(i18n("&Utilize unison + ssh for bidirectional synchronization with remote server\nExample: ssh://servername//path/to/remote/folder"), layoutg); + rsync_rb1 = new TQRadioButton(i18n("&Utilize rsync + ssh for upload to remote server\nExample: servername:/path/to/remote/folder"), tqlayoutg); + rsync_rb2 = new TQRadioButton(i18n("&Utilize rsync + ssh for download from remote server\nExample: servername:/path/to/remote/folder"), tqlayoutg); + rsync_rb3 = new TQRadioButton(i18n("&Utilize unison + ssh for bidirectional synchronization with remote server\nExample: ssh://servername//path/to/remote/folder"), tqlayoutg); if (syncmode == 1) rsync_rb1->setChecked( TRUE ); @@ -143,15 +143,15 @@ RsyncConfigDialog::RsyncConfigDialog(TQWidget* parent, const char* name, else if (syncmode == 3) rsync_rb3->setChecked( TRUE ); - //(void)new TQRadioButton( "R&adiobutton 2", layoutg ); - //(void)new TQRadioButton( "Ra&diobutton 3", layoutg ); + //(void)new TQRadioButton( "R&adiobutton 2", tqlayoutg ); + //(void)new TQRadioButton( "Ra&diobutton 3", tqlayoutg ); // Create an exclusive button group - TQButtonGroup *layoutm = new TQButtonGroup( 1, TQGroupBox::Horizontal, i18n("Remote Folder")+TQString(":"), mainWidget); - layout->addWidget( layoutm ); - layoutg->setExclusive( TRUE ); + TQButtonGroup *tqlayoutm = new TQButtonGroup( 1, Qt::Horizontal, i18n("Remote Folder")+TQString(":"), mainWidget); + tqlayout->addWidget( tqlayoutm ); + tqlayoutg->setExclusive( TRUE ); - m_rsync_txt = new TQLineEdit(layoutm); + m_rsync_txt = new TQLineEdit(tqlayoutm); if (remotefolder.isEmpty() == false) { m_rsync_txt->setText(remotefolder); } diff --git a/konq-plugins/rsync/rsyncconfigdialog.h b/konq-plugins/rsync/rsyncconfigdialog.h index 8e02d54..44ab118 100644 --- a/konq-plugins/rsync/rsyncconfigdialog.h +++ b/konq-plugins/rsync/rsyncconfigdialog.h @@ -37,13 +37,14 @@ class RsyncConfigDialog : public KDialogBase { Q_OBJECT + TQ_OBJECT public: - RsyncConfigDialog(TQWidget* parent = 0, const char* name = 0, - const TQString& caption = TQString::null, - const TQString& text = TQString::null, - const TQString& localfolder = TQString::null, - const TQString& remotefolder = TQString::null, + RsyncConfigDialog(TQWidget* tqparent = 0, const char* name = 0, + const TQString& caption = TQString(), + const TQString& text = TQString(), + const TQString& localfolder = TQString(), + const TQString& remotefolder = TQString(), int syncmode = 1, bool modal = false); /** diff --git a/konq-plugins/rsync/rsyncplugin.cpp b/konq-plugins/rsync/rsyncplugin.cpp index 81a5253..b223a93 100644 --- a/konq-plugins/rsync/rsyncplugin.cpp +++ b/konq-plugins/rsync/rsyncplugin.cpp @@ -106,13 +106,13 @@ typedef KGenericFactory<RsyncPlugin> RsyncPluginFactory; K_EXPORT_COMPONENT_FACTORY(librsyncplugin, RsyncPluginFactory("rsyncplugin")) -RsyncPlugin::RsyncPlugin (TQObject* parent, const char* name, +RsyncPlugin::RsyncPlugin (TQObject* tqparent, const char* name, const TQStringList&) - :KParts::Plugin (parent, name), + :KParts::Plugin (tqparent, name), m_pSyncNow(0), m_pSyncSetup(0) { - m_part = ::qt_cast<KonqDirPart*>(parent); + m_part = ::tqqt_cast<KonqDirPart*>(tqparent); if ( !m_part || !m_part->scrollWidget() ) return; @@ -224,7 +224,7 @@ creates the unidirectional sync subprocess bool RsyncPlugin::syncUnidirectional(TQString synccommand, TQString syncflags, int parameter_order, TQString localfolder, TQString remotepath) { int fd[2]; int rc, flags; - thisFn = TQString::null; + thisFn = TQString(); rc = open_pty_pair(fd); if (rc == -1) { @@ -361,7 +361,7 @@ creates the bidirectional sync subprocess bool RsyncPlugin::syncBidirectional(TQString synccommand, TQString syncflags, int parameter_order, TQString localfolder, TQString remotepath) { int fd[2]; int rc, flags; - thisFn = TQString::null; + thisFn = TQString(); // Check for and remove the trailing slash in localfolder if (localfolder.endsWith("/")) { @@ -521,17 +521,17 @@ int RsyncPlugin::establishConnectionRsync(char *buffer, KIO::fileoffset_t len) { buf.truncate(buf.length()-1); myDebug( << "establishing: got " << buf << endl); - while (childPid && ((pos = buf.find('\n')) >= 0 || buf.endsWith(":") || buf.endsWith("?"))) { + while (childPid && ((pos = buf.tqfind('\n')) >= 0 || buf.endsWith(":") || buf.endsWith("?"))) { if (m_progressDialogExists == true) { - qApp->processEvents(); + tqApp->processEvents(); } pos++; TQString str = buf.left(pos); buf = buf.mid(pos); if (str == "\n") continue; - //if (str.contains("rsync error:")) { - if (str.contains("rsync:") || str.contains("failed.") || (str.contains("Could not") && str.endsWith("."))) { + //if (str.tqcontains("rsync error:")) { + if (str.tqcontains("rsync:") || str.tqcontains("failed.") || (str.tqcontains("Could not") && str.endsWith("."))) { KMessageBox::error(NULL, str); } else if (!str.isEmpty()) { @@ -557,12 +557,12 @@ int RsyncPlugin::establishConnectionRsync(char *buffer, KIO::fileoffset_t len) { } else if (!connectionPassword.isEmpty()) { myDebug( << "sending cpass" << endl); connectionAuth.password = connectionPassword+"\n"; - connectionPassword = TQString::null; + connectionPassword = TQString(); writeChild(connectionAuth.password.latin1(),connectionAuth.password.length()); } else { myDebug( << "sending mpass" << endl); connectionAuth.prompt = thisFn+buf; - connectionAuth.password = TQString::null; // don't prefill + connectionAuth.password = TQString(); // don't prefill TQCString thispass; if (KPasswordDialog::getPassword (thispass, i18n("Remote authorization required") + TQString("\n") + i18n("Please input") + TQString(" ") + TQString(buf), NULL) != 1) { shutdownConnection(true, false); @@ -575,7 +575,7 @@ int RsyncPlugin::establishConnectionRsync(char *buffer, KIO::fileoffset_t len) { myDebug( << "sending pass" << endl); writeChild(connectionAuth.password.latin1(),connectionAuth.password.length()); } - thisFn = TQString::null; + thisFn = TQString(); return 0; } else if (buf.endsWith("?")) { @@ -585,25 +585,25 @@ int RsyncPlugin::establishConnectionRsync(char *buffer, KIO::fileoffset_t len) { } else { writeChild("no\n",3); } - thisFn = TQString::null; + thisFn = TQString(); return 0; } if (m_progressDialogExists == true) { - if (str.contains("exit()") && str.contains("ICE default IO")) { + if (str.tqcontains("exit()") && str.tqcontains("ICE default IO")) { if (m_progressDialogExists == true) { m_progressDialog->progressBar()->setValue(m_progressDialog->progressBar()->totalSteps()); } } else { - if (str.contains(", to-check=")) { + if (str.tqcontains(", to-check=")) { // Parse the to-check output TQString tocheck_out_cur; TQString tocheck_out_tot; - tocheck_out_cur = str.mid(str.find(", to-check=") + 11, str.length()); - tocheck_out_tot = tocheck_out_cur.mid(tocheck_out_cur.find("/") + 1, tocheck_out_cur.length()); - tocheck_out_cur = tocheck_out_cur.left(tocheck_out_cur.find("/")); - tocheck_out_tot = tocheck_out_tot.left(tocheck_out_tot.find(")")); + tocheck_out_cur = str.mid(str.tqfind(", to-check=") + 11, str.length()); + tocheck_out_tot = tocheck_out_cur.mid(tocheck_out_cur.tqfind("/") + 1, tocheck_out_cur.length()); + tocheck_out_cur = tocheck_out_cur.left(tocheck_out_cur.tqfind("/")); + tocheck_out_tot = tocheck_out_tot.left(tocheck_out_tot.tqfind(")")); m_progressDialog->progressBar()->setTotalSteps(tocheck_out_tot.toInt()-1); m_progressDialog->progressBar()->setValue(tocheck_out_tot.toInt()-tocheck_out_cur.toInt()-2); } @@ -629,17 +629,17 @@ int RsyncPlugin::establishConnectionUnison(char *buffer, KIO::fileoffset_t len, buf.truncate(buf.length()-1); myDebug( << "establishing: got " << buf << endl); - while (childPid && (((pos = buf.find('\n')) >= 0) || buf.endsWith(":") || buf.endsWith("?") || buf.endsWith("]"))) { + while (childPid && (((pos = buf.tqfind('\n')) >= 0) || buf.endsWith(":") || buf.endsWith("?") || buf.endsWith("]"))) { if (m_progressDialogExists == true) { - qApp->processEvents(); + tqApp->processEvents(); } pos++; TQString str = buf.left(pos); buf = buf.mid(pos); if (str == "\n") continue; - //if (str.contains("rsync error:")) { - if (str.contains("rsync:") || str.contains("failed.") || (str.contains("Could not") && str.endsWith("."))) { + //if (str.tqcontains("rsync error:")) { + if (str.tqcontains("rsync:") || str.tqcontains("failed.") || (str.tqcontains("Could not") && str.endsWith("."))) { KMessageBox::error(NULL, str); } else if (!str.isEmpty()) { @@ -664,12 +664,12 @@ int RsyncPlugin::establishConnectionUnison(char *buffer, KIO::fileoffset_t len, } else if (!connectionPassword.isEmpty()) { myDebug( << "sending cpass" << endl); connectionAuth.password = connectionPassword+"\n"; - connectionPassword = TQString::null; + connectionPassword = TQString(); writeChild(connectionAuth.password.latin1(),connectionAuth.password.length()); } else { myDebug( << "sending mpass" << endl); connectionAuth.prompt = thisFn+buf; - connectionAuth.password = TQString::null; // don't prefill + connectionAuth.password = TQString(); // don't prefill TQCString thispass; if (KPasswordDialog::getPassword (thispass, i18n("Remote authorization required") + TQString("\n") + i18n("Please input") + TQString(" ") + TQString(buf), NULL) != 1) { slotUnisonCancelled(); @@ -682,11 +682,11 @@ int RsyncPlugin::establishConnectionUnison(char *buffer, KIO::fileoffset_t len, myDebug( << "sending pass" << endl); writeChild(connectionAuth.password.latin1(),connectionAuth.password.length()); } - thisFn = TQString::null; + thisFn = TQString(); return 0; } else if (buf.endsWith("?") || buf.endsWith("? []")) { - buf.replace("[]", ""); + buf.tqreplace("[]", ""); if (buf.endsWith("? []")) { int rc = KMessageBox::questionYesNo(NULL, buf); if (rc == KMessageBox::Yes) { @@ -703,7 +703,7 @@ int RsyncPlugin::establishConnectionUnison(char *buffer, KIO::fileoffset_t len, writeChild("no\n",3); } } - thisFn = TQString::null; + thisFn = TQString(); buf = ""; return 0; } @@ -717,11 +717,11 @@ int RsyncPlugin::establishConnectionUnison(char *buffer, KIO::fileoffset_t len, } TQString file_name; file_name = buf; - file_name.replace("[]", ""); - file_name.replace(TQString("changed "), ""); + file_name.tqreplace("[]", ""); + file_name.tqreplace(TQString("changed "), ""); //file_name = file_name.simplifyWhiteSpace(); KDialogBase *dialog= new KDialogBase(i18n("User Intervention Required"), KDialogBase::Yes | KDialogBase::No | KDialogBase::Cancel, KDialogBase::Yes, KDialogBase::Cancel, NULL, "warningYesNoCancel", true, true, i18n("Use &Local File"), i18n("Use &Remote File"), i18n("&Ignore")); - int rc = KMessageBox::createKMessageBox(dialog, TQMessageBox::Warning, TQString("<b>") + i18n("WARNING: Both the local and remote file have been modified") + TQString("</b><p>") + i18n("Local") + TQString(": ") + localfolder + TQString("/") + file_name + TQString("<br>") + i18n("Remote") + TQString(": ") + remotepath + TQString("/") + file_name + TQString("<p>") + i18n("Please select the file to duplicate (the other will be overwritten)") + TQString("<br>") + i18n("Or, select Ignore to skip synchronization of this file for now"), TQStringList(), TQString::null, NULL, 1); + int rc = KMessageBox::createKMessageBox(dialog, TQMessageBox::Warning, TQString("<b>") + i18n("WARNING: Both the local and remote file have been modified") + TQString("</b><p>") + i18n("Local") + TQString(": ") + localfolder + TQString("/") + file_name + TQString("<br>") + i18n("Remote") + TQString(": ") + remotepath + TQString("/") + file_name + TQString("<p>") + i18n("Please select the file to duplicate (the other will be overwritten)") + TQString("<br>") + i18n("Or, select Ignore to skip synchronization of this file for now"), TQStringList(), TQString(), NULL, 1); if (rc == KDialogBase::Yes) { writeChild(">\n",3); } @@ -735,7 +735,7 @@ int RsyncPlugin::establishConnectionUnison(char *buffer, KIO::fileoffset_t len, } if (m_progressDialogExists == true) { - if (str.contains("exit()") && str.contains("ICE default IO")) { + if (str.tqcontains("exit()") && str.tqcontains("ICE default IO")) { if (m_progressDialogExists == true) { m_progressDialog->progressBar()->setFormat("%v / %m"); m_progressDialog->progressBar()->setTotalSteps(2); @@ -822,7 +822,7 @@ TQString RsyncPlugin::findLocalFolderByName(TQString folderurl) { TQString folderurl_stripped; folderurl_stripped = folderurl; - folderurl_stripped.replace(TQString("file://"), TQString("")); + folderurl_stripped.tqreplace(TQString("file://"), TQString("")); for (TQStringList::Iterator i(cfgfolderlist.begin()); i != cfgfolderlist.end(); ++i) { if (TQString::compare((*i), folderurl_stripped) == 0) { i++; @@ -841,7 +841,7 @@ TQString RsyncPlugin::findSyncMethodByName(TQString folderurl) { TQString folderurl_stripped; folderurl_stripped = folderurl; - folderurl_stripped.replace(TQString("file://"), TQString("")); + folderurl_stripped.tqreplace(TQString("file://"), TQString("")); for (TQStringList::Iterator i(cfgfolderlist.begin()); i != cfgfolderlist.end(); ++i) { if (TQString::compare((*i), folderurl_stripped) == 0) { i++; @@ -860,7 +860,7 @@ TQString RsyncPlugin::findLoginSyncEnabledByName(TQString folderurl) { TQString folderurl_stripped; folderurl_stripped = folderurl; - folderurl_stripped.replace(TQString("file://"), TQString("")); + folderurl_stripped.tqreplace(TQString("file://"), TQString("")); for (TQStringList::Iterator i(cfgfolderlist.begin()); i != cfgfolderlist.end(); ++i) { if (TQString::compare((*i), folderurl_stripped) == 0) { i++; @@ -879,7 +879,7 @@ TQString RsyncPlugin::findLogoutSyncEnabledByName(TQString folderurl) { TQString folderurl_stripped; folderurl_stripped = folderurl; - folderurl_stripped.replace(TQString("file://"), TQString("")); + folderurl_stripped.tqreplace(TQString("file://"), TQString("")); for (TQStringList::Iterator i(cfgfolderlist.begin()); i != cfgfolderlist.end(); ++i) { if (TQString::compare((*i), folderurl_stripped) == 0) { i++; @@ -898,7 +898,7 @@ TQString RsyncPlugin::findTimedSyncEnabledByName(TQString folderurl) { TQString folderurl_stripped; folderurl_stripped = folderurl; - folderurl_stripped.replace(TQString("file://"), TQString("")); + folderurl_stripped.tqreplace(TQString("file://"), TQString("")); for (TQStringList::Iterator i(cfgfolderlist.begin()); i != cfgfolderlist.end(); ++i) { if (TQString::compare((*i), folderurl_stripped) == 0) { i++; @@ -917,7 +917,7 @@ int RsyncPlugin::deleteLocalFolderByName(TQString folderurl) { TQString folderurl_stripped; folderurl_stripped = folderurl; - folderurl_stripped.replace(TQString("file://"), TQString("")); + folderurl_stripped.tqreplace(TQString("file://"), TQString("")); for (TQStringList::Iterator i(cfgfolderlist.begin()); i != cfgfolderlist.end(); ++i) { if (TQString::compare((*i), folderurl_stripped) == 0) { i=cfgfolderlist.remove(i); @@ -937,7 +937,7 @@ int RsyncPlugin::addLocalFolderByName(TQString folderurl, TQString remoteurl, TQ { TQString folderurl_stripped; folderurl_stripped = folderurl; - folderurl_stripped.replace(TQString("file://"), TQString("")); + folderurl_stripped.tqreplace(TQString("file://"), TQString("")); cfgfolderlist.append(folderurl); cfgfolderlist.append(remoteurl); cfgfolderlist.append(syncmethod); diff --git a/konq-plugins/rsync/rsyncplugin.h b/konq-plugins/rsync/rsyncplugin.h index 0adbfc0..6c58d0d 100644 --- a/konq-plugins/rsync/rsyncplugin.h +++ b/konq-plugins/rsync/rsyncplugin.h @@ -48,10 +48,11 @@ namespace KParts class RsyncPlugin : public KParts::Plugin { Q_OBJECT + TQ_OBJECT public: - RsyncPlugin (TQObject* parent, const char* name, const TQStringList &); + RsyncPlugin (TQObject* tqparent, const char* name, const TQStringList &); virtual ~RsyncPlugin(); protected: |