From f636ba5ba2df9d34d56b1c85f24c6598fa1cb645 Mon Sep 17 00:00:00 2001 From: tpearson Date: Mon, 27 Jun 2011 05:58:16 +0000 Subject: TQt4 port kdiff3 This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kdiff3@1238464 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kdiff3plugin/Makefile.am | 2 +- kdiff3plugin/kdiff3plugin.cpp | 54 +++++++++++++++++++++---------------------- kdiff3plugin/kdiff3plugin.h | 11 +++++---- 3 files changed, 34 insertions(+), 33 deletions(-) (limited to 'kdiff3plugin') diff --git a/kdiff3plugin/Makefile.am b/kdiff3plugin/Makefile.am index 2a4e129..fcc8798 100644 --- a/kdiff3plugin/Makefile.am +++ b/kdiff3plugin/Makefile.am @@ -6,7 +6,7 @@ kde_module_LTLIBRARIES = libkdiff3plugin.la libkdiff3plugin_la_SOURCES = kdiff3plugin.cpp libkdiff3plugin_la_LIBADD = -lkonq -libkdiff3plugin_la_LDFLAGS = -module $(all_libraries) $(KDE_PLUGIN) +libkdiff3plugin_la_LDFLAGS = -module $(all_libraries) $(KDE_PLUGIN) $(LIB_QT) #KDE_ICON = KDiff3 diff --git a/kdiff3plugin/kdiff3plugin.cpp b/kdiff3plugin/kdiff3plugin.cpp index 293f899..08a3cbe 100755 --- a/kdiff3plugin/kdiff3plugin.cpp +++ b/kdiff3plugin/kdiff3plugin.cpp @@ -31,7 +31,7 @@ //#include -static QStringList* s_pHistory=0; +static TQStringList* s_pHistory=0; class KDiff3PluginFactory : public KGenericFactory < KDiff3Plugin, KonqPopupMenu > { @@ -44,7 +44,7 @@ public: if (s_pHistory==0) { //std::cout << "New History: " << instanceName << std::endl; - s_pHistory = new QStringList; + s_pHistory = new TQStringList; m_pConfig = new KSimpleConfig( "kdiff3pluginrc", false ); *s_pHistory = m_pConfig->readListEntry("HistoryStack"); } @@ -64,17 +64,17 @@ public: K_EXPORT_COMPONENT_FACTORY (libkdiff3plugin, KDiff3PluginFactory ("kdiff3plugin")) -KDiff3Plugin::KDiff3Plugin( KonqPopupMenu* pPopupmenu, const char *name, const QStringList & /* list */ ) +KDiff3Plugin::KDiff3Plugin( KonqPopupMenu* pPopupmenu, const char *name, const TQStringList & /* list */ ) :KonqPopupMenuPlugin (pPopupmenu, name) { if (KStandardDirs::findExe ("kdiff3").isNull ()) return; - m_pParentWidget = pPopupmenu->parentWidget(); + m_pParentWidget = pPopupmenu->tqparentWidget(); KGlobal::locale()->insertCatalogue("kdiff3_plugin"); - // remember currently selected files (copy to a QStringList) + // remember currently selected files (copy to a TQStringList) KFileItemList itemList = pPopupmenu->fileItemList(); for ( KFileItem *item = itemList.first(); item; item = itemList.next() ) { @@ -96,27 +96,27 @@ KDiff3Plugin::KDiff3Plugin( KonqPopupMenu* pPopupmenu, const char *name, const Q KActionMenu* pActionMenu = new KActionMenu (i18n ("KDiff3"), "kdiff3", actionCollection (), "kdiff3_menu" ); KAction* pAction = 0; - QString s; + TQString s; if(m_list.count() == 1) { int historyCount = s_pHistory ? s_pHistory->count() : 0; - s = i18n("Compare with %1").arg( historyCount>0 ? s_pHistory->front() : QString() ); - pAction = new KAction ( s,0, this, SLOT(slotCompareWith()), actionCollection()); + s = i18n("Compare with %1").tqarg( historyCount>0 ? s_pHistory->front() : TQString() ); + pAction = new KAction ( s,0, this, TQT_SLOT(slotCompareWith()), actionCollection()); pAction->setEnabled( m_list.count()>0 && historyCount>0 ); pActionMenu->insert (pAction); - s = i18n("Merge with %1").arg( historyCount>0 ? s_pHistory->front() : QString() ); - pAction = new KAction( s, 0, this, SLOT(slotMergeWith()), actionCollection()); + s = i18n("Merge with %1").tqarg( historyCount>0 ? s_pHistory->front() : TQString() ); + pAction = new KAction( s, 0, this, TQT_SLOT(slotMergeWith()), actionCollection()); pAction->setEnabled( m_list.count()>0 && historyCount>0 ); pActionMenu->insert (pAction); - s = i18n("Save '%1' for later").arg( ( m_list.front() ) ); - pAction = new KAction ( s, 0, this, SLOT(slotSaveForLater()), actionCollection()); + s = i18n("Save '%1' for later").tqarg( ( m_list.front() ) ); + pAction = new KAction ( s, 0, this, TQT_SLOT(slotSaveForLater()), actionCollection()); pAction->setEnabled( m_list.count()>0 ); pActionMenu->insert(pAction); - pAction = new KAction (i18n("3-way merge with base"), 0, this, SLOT(slotMergeThreeWay()), actionCollection()); + pAction = new KAction (i18n("3-way merge with base"), 0, this, TQT_SLOT(slotMergeThreeWay()), actionCollection()); pAction->setEnabled( m_list.count()>0 && historyCount>=2 ); pActionMenu->insert (pAction); @@ -125,32 +125,32 @@ KDiff3Plugin::KDiff3Plugin( KonqPopupMenu* pPopupmenu, const char *name, const Q KActionMenu* pHistoryMenu = new KActionMenu( i18n("Compare with ..."), "CompareWith", actionCollection (), "kdiff3_history_menu"); pHistoryMenu->setEnabled( m_list.count()>0 && historyCount>0 ); pActionMenu->insert(pHistoryMenu); - for (QStringList::iterator i = s_pHistory->begin(); i!=s_pHistory->end(); ++i) + for (TQStringList::iterator i = s_pHistory->begin(); i!=s_pHistory->end(); ++i) { - pAction = new KAction( *i, "History", 0, this, SLOT(slotCompareWithHistoryItem()), actionCollection()); + pAction = new KAction( *i, "History", 0, this, TQT_SLOT(slotCompareWithHistoryItem()), actionCollection()); pHistoryMenu->insert (pAction); } - pAction = new KAction (i18n("Clear list"), 0, this, SLOT(slotClearList()), actionCollection()); + pAction = new KAction (i18n("Clear list"), 0, this, TQT_SLOT(slotClearList()), actionCollection()); pActionMenu->insert (pAction); pAction->setEnabled( historyCount>0 ); } } else if(m_list.count() == 2) { - pAction = new KAction (i18n("Compare"), 0, this, SLOT(slotCompareTwoFiles()), actionCollection()); + pAction = new KAction (i18n("Compare"), 0, this, TQT_SLOT(slotCompareTwoFiles()), actionCollection()); pActionMenu->insert (pAction); } else if ( m_list.count() == 3 ) { - pAction = new KAction (i18n("3 way comparison"), 0, this, SLOT(slotCompareThreeFiles()), actionCollection()); + pAction = new KAction (i18n("3 way comparison"), 0, this, TQT_SLOT(slotCompareThreeFiles()), actionCollection()); pActionMenu->insert (pAction); } - pAction = new KAction (i18n("About KDiff3 menu plugin ..."), 0, this, SLOT(slotAbout()), actionCollection()); + pAction = new KAction (i18n("About KDiff3 menu plugin ..."), 0, this, TQT_SLOT(slotAbout()), actionCollection()); pActionMenu->insert (pAction); addSeparator(); - addAction( pActionMenu ); + tqaddAction( pActionMenu ); addSeparator(); } @@ -162,7 +162,7 @@ void KDiff3Plugin::slotCompareWith() { if ( m_list.count() > 0 && s_pHistory && ! s_pHistory->empty() ) { - QStringList args; + TQStringList args; args << s_pHistory->front(); args << m_list.front(); kapp->kdeinitExec ("kdiff3", args); @@ -174,7 +174,7 @@ void KDiff3Plugin::slotCompareWithHistoryItem() const KAction* pAction = dynamic_cast( sender() ); if ( m_list.count() > 0 && pAction ) { - QStringList args; + TQStringList args; args << pAction->text(); args << m_list.front(); kapp->kdeinitExec ("kdiff3", args); @@ -185,7 +185,7 @@ void KDiff3Plugin::slotCompareTwoFiles() { if ( m_list.count() == 2 ) { - QStringList args; + TQStringList args; args << m_list.front(); args << m_list.back(); kapp->kdeinitExec ("kdiff3", args); @@ -196,7 +196,7 @@ void KDiff3Plugin::slotCompareThreeFiles() { if ( m_list.count() == 3 ) { - QStringList args; + TQStringList args; args << m_list[0]; args << m_list[1]; args << m_list[2]; @@ -208,7 +208,7 @@ void KDiff3Plugin::slotMergeWith() { if ( m_list.count() > 0 && s_pHistory && ! s_pHistory->empty() ) { - QStringList args; + TQStringList args; args << s_pHistory->front(); args << m_list.front(); args << ( "-o" + m_list.front() ); @@ -220,7 +220,7 @@ void KDiff3Plugin::slotMergeThreeWay() { if ( m_list.count() > 0 && s_pHistory && s_pHistory->count()>=2 ) { - QStringList args; + TQStringList args; args << (*s_pHistory)[1]; args << (*s_pHistory)[0]; args << m_list.front(); @@ -247,7 +247,7 @@ void KDiff3Plugin::slotClearList() void KDiff3Plugin::slotAbout() { - QString s = i18n("KDiff3 Menu Plugin: Copyright (C) 2006 Joachim Eibl\n" + TQString s = i18n("KDiff3 Menu Plugin: Copyright (C) 2006 Joachim Eibl\n" "KDiff3 homepage: http://kdiff3.sourceforge.net\n\n"); s += i18n("Using the contextmenu extension:\n" "For simple comparison of two selected 2 files choose \"Compare\".\n" diff --git a/kdiff3plugin/kdiff3plugin.h b/kdiff3plugin/kdiff3plugin.h index 14ebf60..e627b9d 100755 --- a/kdiff3plugin/kdiff3plugin.h +++ b/kdiff3plugin/kdiff3plugin.h @@ -23,13 +23,14 @@ #include -class QStringList; +class TQStringList; class KDiff3Plugin : public KonqPopupMenuPlugin { - Q_OBJECT + Q_OBJECT + TQ_OBJECT public: - KDiff3Plugin (KonqPopupMenu *, const char *name, const QStringList & list); + KDiff3Plugin (KonqPopupMenu *, const char *name, const TQStringList & list); virtual ~KDiff3Plugin(); private slots: @@ -44,7 +45,7 @@ private slots: void slotAbout(); private: - QStringList m_list; - QWidget* m_pParentWidget; + TQStringList m_list; + TQWidget* m_pParentWidget; }; #endif -- cgit v1.2.1