summaryrefslogtreecommitdiffstats
path: root/plugins/scanfolder
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-28 20:34:15 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-28 20:34:15 +0000
commit1c1403293485f35fd53db45aaa77a01cdd9627e7 (patch)
tree38559cd68cd4f63023fb5f6375def9db3b8b491e /plugins/scanfolder
parent894f94545727610df22c4f73911d62d58266f695 (diff)
downloadktorrent-1c1403293485f35fd53db45aaa77a01cdd9627e7.tar.gz
ktorrent-1c1403293485f35fd53db45aaa77a01cdd9627e7.zip
TQt4 port ktorrent
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/ktorrent@1238733 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'plugins/scanfolder')
-rw-r--r--plugins/scanfolder/scanfolder.cpp58
-rw-r--r--plugins/scanfolder/scanfolder.h23
-rw-r--r--plugins/scanfolder/scanfolderplugin.cpp30
-rw-r--r--plugins/scanfolder/scanfolderplugin.h7
-rw-r--r--plugins/scanfolder/scanfolderprefpage.cpp4
-rw-r--r--plugins/scanfolder/scanfolderprefpage.h2
-rw-r--r--plugins/scanfolder/scanfolderprefpagewidget.cpp32
-rw-r--r--plugins/scanfolder/scanfolderprefpagewidget.h3
-rw-r--r--plugins/scanfolder/sfprefwidgetbase.ui34
9 files changed, 98 insertions, 95 deletions
diff --git a/plugins/scanfolder/scanfolder.cpp b/plugins/scanfolder/scanfolder.cpp
index 3c30299..36b1ce2 100644
--- a/plugins/scanfolder/scanfolder.cpp
+++ b/plugins/scanfolder/scanfolder.cpp
@@ -24,10 +24,10 @@
#include <klocale.h>
#include <kio/job.h>
-#include <qstring.h>
-#include <qobject.h>
-#include <qfile.h>
-#include <qvaluelist.h>
+#include <tqstring.h>
+#include <tqobject.h>
+#include <tqfile.h>
+#include <tqvaluelist.h>
#include <torrent/globals.h>
#include <util/log.h>
@@ -45,7 +45,7 @@ using namespace bt;
namespace kt
{
- ScanFolder::ScanFolder(CoreInterface* core, QString& dir, LoadedTorrentAction action, bool openSilently)
+ ScanFolder::ScanFolder(CoreInterface* core, TQString& dir, LoadedTorrentAction action, bool openSilently)
: m_core(core), m_dir(0), m_loadedAction(action), m_openSilently(openSilently)
{
m_dir = new KDirLister();
@@ -58,9 +58,9 @@ namespace kt
m_dir->setShowingDotFiles(true);
- connect(m_dir, SIGNAL(newItems( const KFileItemList& )), this, SLOT(onNewItems( const KFileItemList& )));
- connect(m_core, SIGNAL(loadingFinished( const KURL&, bool, bool )), this, SLOT(onLoadingFinished( const KURL&, bool, bool )));
- connect(&m_incomplePollingTimer,SIGNAL(timeout()),this,SLOT(onIncompletePollingTimeout()));
+ connect(m_dir, TQT_SIGNAL(newItems( const KFileItemList& )), this, TQT_SLOT(onNewItems( const KFileItemList& )));
+ connect(m_core, TQT_SIGNAL(loadingFinished( const KURL&, bool, bool )), this, TQT_SLOT(onLoadingFinished( const KURL&, bool, bool )));
+ connect(&m_incomplePollingTimer,TQT_SIGNAL(timeout()),this,TQT_SLOT(onIncompletePollingTimeout()));
}
@@ -76,9 +76,9 @@ namespace kt
KFileItem* file;
for(file=list.first(); file; file=list.next())
{
- QString name = file->name();
- QString dirname = m_dir->url().path();
- QString filename = dirname + bt::DirSeparator() + name;
+ TQString name = file->name();
+ TQString dirname = m_dir->url().path();
+ TQString filename = dirname + bt::DirSeparator() + name;
if(!name.endsWith(".torrent"))
continue;
@@ -86,8 +86,8 @@ namespace kt
if(name.startsWith("."))
{
//Check if corresponding torrent exists
- if(!QFile::exists(m_dir->url().path() + bt::DirSeparator() + name.right(name.length() - 1)) && (m_loadedAction == defaultAction))
- QFile::remove(filename);
+ if(!TQFile::exists(m_dir->url().path() + bt::DirSeparator() + name.right(name.length() - 1)) && (m_loadedAction == defaultAction))
+ TQFile::remove(filename);
continue;
}
@@ -96,7 +96,7 @@ namespace kt
source.setPath(filename);
//If torrent has it's hidden complement - skip it.
- if(QFile::exists(dirname + "/." + name))
+ if(TQFile::exists(dirname + "/." + name))
continue;
if (incomplete(source))
@@ -132,7 +132,7 @@ namespace kt
return;
//search for entry
- QValueList<KURL>::iterator it = m_pendingURLs.find(url);
+ TQValueList<KURL>::iterator it = m_pendingURLs.tqfind(url);
//if no entry is found than this torrent was not started by this plugin so - quit
if(it == m_pendingURLs.end())
@@ -144,30 +144,30 @@ namespace kt
if(canceled)
return;
- QString name = url.filename(false);
- QString dirname = m_dir->url().path();
- QString filename = dirname + "/" + name;
+ TQString name = url.filename(false);
+ TQString dirname = m_dir->url().path();
+ TQString filename = dirname + "/" + name;
KURL destination(dirname + "/" + i18n("loaded") + "/" + name);
switch(m_loadedAction) {
case deleteAction:
//If torrent has it's hidden complement - remove it too.
- if(QFile::exists(dirname + "/." + name))
- QFile::remove(dirname + "/." + name);
+ if(TQFile::exists(dirname + "/." + name))
+ TQFile::remove(dirname + "/." + name);
// Out() << "Deleting: " << name.ascii() << endl;
- QFile::remove(filename);
+ TQFile::remove(filename);
break;
case moveAction:
// Out() << "Moving: " << name.ascii() << endl;
//If torrent has it's hidden complement - remove it too.
- if(QFile::exists(dirname + "/." + name))
- QFile::remove(dirname + "/." + name);
+ if(TQFile::exists(dirname + "/." + name))
+ TQFile::remove(dirname + "/." + name);
// NetAccess considered harmfull !!!
KIO::file_move(url, destination);
break;
case defaultAction:
- QFile f(dirname + "/." + name);
+ TQFile f(dirname + "/." + name);
f.open(IO_WriteOnly);
f.close();
break;
@@ -183,13 +183,13 @@ namespace kt
{
m_loadedAction = theValue;
- QDir tmp(m_dir->url().path());
+ TQDir tmp(m_dir->url().path());
if( (m_loadedAction == moveAction) && !tmp.exists(i18n("loaded"), false))
tmp.mkdir(i18n("loaded"), false);
}
- void ScanFolder::setFolderUrl(QString& url)
+ void ScanFolder::setFolderUrl(TQString& url)
{
if(!m_dir->openURL(url)) {
m_valid = false;
@@ -201,13 +201,13 @@ namespace kt
bool ScanFolder::incomplete(const KURL & src)
{
// try to decode file, if it is syntactically correct, we can try to load it
- QFile fptr(src.path());
+ TQFile fptr(src.path());
if (!fptr.open(IO_ReadOnly))
return false;
try
{
- QByteArray data(fptr.size());
+ TQByteArray data(fptr.size());
fptr.readBlock(data.data(),fptr.size());
bt::BDecoder dec(data,false);
bt::BNode* n = dec.decode();
@@ -234,7 +234,7 @@ namespace kt
void ScanFolder::onIncompletePollingTimeout()
{
bt::Out(SYS_SNF|LOG_NOTICE) << "ScanFolder : checking incomplete files" << endl;
- for (QValueList<KURL>::iterator i = m_incompleteURLs.begin(); i != m_incompleteURLs.end();)
+ for (TQValueList<KURL>::iterator i = m_incompleteURLs.begin(); i != m_incompleteURLs.end();)
{
KURL source = *i;
if (!bt::Exists(source.path()))
diff --git a/plugins/scanfolder/scanfolder.h b/plugins/scanfolder/scanfolder.h
index 8e8c27c..fdae09a 100644
--- a/plugins/scanfolder/scanfolder.h
+++ b/plugins/scanfolder/scanfolder.h
@@ -22,11 +22,11 @@
#include <kdirlister.h>
#include <kfileitem.h>
-#include <qstring.h>
-#include <qobject.h>
-#include <qdir.h>
-#include <qvaluelist.h>
-#include <qtimer.h>
+#include <tqstring.h>
+#include <tqobject.h>
+#include <tqdir.h>
+#include <tqvaluelist.h>
+#include <tqtimer.h>
#include <kurl.h>
namespace kt
@@ -53,9 +53,10 @@ namespace kt
* @see LoadedTorrentAction
*
*/
- class ScanFolder : public QObject
+ class ScanFolder : public TQObject
{
Q_OBJECT
+ TQ_OBJECT
public:
/**
@@ -65,7 +66,7 @@ namespace kt
* @param action Action to perform on loaded torrents.
* @param openSilently Wheather to open torrent silently or not.
*/
- ScanFolder(CoreInterface* core, QString& dir, LoadedTorrentAction action = defaultAction, bool openSilently = true);
+ ScanFolder(CoreInterface* core, TQString& dir, LoadedTorrentAction action = defaultAction, bool openSilently = true);
~ScanFolder();
///Accessor method for m_openSilently.
@@ -82,7 +83,7 @@ namespace kt
bool isValid() const { return m_valid; }
///Sets directory path
- void setFolderUrl(QString& url);
+ void setFolderUrl(TQString& url);
public slots:
void onNewItems(const KFileItemList &items);
@@ -102,10 +103,10 @@ namespace kt
LoadedTorrentAction m_loadedAction;
bool m_openSilently;
- QValueList<KURL> m_pendingURLs;
- QValueList<KURL> m_incompleteURLs;
+ TQValueList<KURL> m_pendingURLs;
+ TQValueList<KURL> m_incompleteURLs;
- QTimer m_incomplePollingTimer;
+ TQTimer m_incomplePollingTimer;
};
}
#endif
diff --git a/plugins/scanfolder/scanfolderplugin.cpp b/plugins/scanfolder/scanfolderplugin.cpp
index a994243..b4bcd5c 100644
--- a/plugins/scanfolder/scanfolderplugin.cpp
+++ b/plugins/scanfolder/scanfolderplugin.cpp
@@ -25,8 +25,8 @@
#include <util/constants.h>
#include <util/log.h>
-#include <qstring.h>
-#include <qfile.h>
+#include <tqstring.h>
+#include <tqfile.h>
#include <kmessagebox.h>
#include <klocale.h>
@@ -43,13 +43,13 @@ K_EXPORT_COMPONENT_FACTORY(ktscanfolderplugin,KGenericFactory<kt::ScanFolderPlug
namespace kt
{
- const QString NAME = "Scan Folder";
- const QString AUTHOR = "Ivan Vasic";
- const QString EMAIL = "ivasic@gmail.com";
- const QString DESCRIPTION = i18n("Automatically scans directories for torrent files and loads them.");
+ const TQString NAME = "Scan Folder";
+ const TQString AUTHOR = "Ivan Vasic";
+ const TQString EMAIL = "ivasic@gmail.com";
+ const TQString DESCRIPTION = i18n("Automatically scans directories for torrent files and loads them.");
- ScanFolderPlugin::ScanFolderPlugin(QObject* parent, const char* name, const QStringList& args)
- : Plugin(parent, name, args,NAME,i18n("Scan Folder"),AUTHOR,EMAIL,DESCRIPTION,"view_sidetree")
+ ScanFolderPlugin::ScanFolderPlugin(TQObject* tqparent, const char* name, const TQStringList& args)
+ : Plugin(tqparent, name, args,NAME,i18n("Scan Folder"),AUTHOR,EMAIL,DESCRIPTION,"view_sidetree")
{
// setXMLFile("ktscanfolderpluginui.rc");
m_sf1 = 0;
@@ -90,13 +90,13 @@ namespace kt
void ScanFolderPlugin::updateScanFolders()
{
- QString sfPath1 = ScanFolderPluginSettings::folder1();
- QString sfPath2 = ScanFolderPluginSettings::folder2();
- QString sfPath3 = ScanFolderPluginSettings::folder3();
+ TQString sfPath1 = ScanFolderPluginSettings::folder1();
+ TQString sfPath2 = ScanFolderPluginSettings::folder2();
+ TQString sfPath3 = ScanFolderPluginSettings::folder3();
- bool valid1 = QFile::exists(sfPath1);
- bool valid2 = QFile::exists(sfPath2);
- bool valid3 = QFile::exists(sfPath3);
+ bool valid1 = TQFile::exists(sfPath1);
+ bool valid2 = TQFile::exists(sfPath2);
+ bool valid3 = TQFile::exists(sfPath3);
bool usesf1 = ScanFolderPluginSettings::useFolder1() && valid1;
bool usesf2 = ScanFolderPluginSettings::useFolder2() && valid2;
@@ -180,7 +180,7 @@ namespace kt
}
- bool ScanFolderPlugin::versionCheck(const QString & version) const
+ bool ScanFolderPlugin::versionCheck(const TQString & version) const
{
return version == KT_VERSION_MACRO;
}
diff --git a/plugins/scanfolder/scanfolderplugin.h b/plugins/scanfolder/scanfolderplugin.h
index 2ef50c1..64f2f5b 100644
--- a/plugins/scanfolder/scanfolderplugin.h
+++ b/plugins/scanfolder/scanfolderplugin.h
@@ -22,7 +22,7 @@
#include <interfaces/plugin.h>
-class QString;
+class TQString;
namespace kt
@@ -38,13 +38,14 @@ namespace kt
class ScanFolderPlugin : public Plugin
{
Q_OBJECT
+ TQ_OBJECT
public:
- ScanFolderPlugin(QObject* parent, const char* name, const QStringList& args);
+ ScanFolderPlugin(TQObject* tqparent, const char* name, const TQStringList& args);
virtual ~ScanFolderPlugin();
virtual void load();
virtual void unload();
- virtual bool versionCheck(const QString& version) const;
+ virtual bool versionCheck(const TQString& version) const;
void updateScanFolders();
diff --git a/plugins/scanfolder/scanfolderprefpage.cpp b/plugins/scanfolder/scanfolderprefpage.cpp
index 9abbf0d..f5a462b 100644
--- a/plugins/scanfolder/scanfolderprefpage.cpp
+++ b/plugins/scanfolder/scanfolderprefpage.cpp
@@ -49,9 +49,9 @@ namespace kt
return true;
}
- void ScanFolderPrefPage::createWidget(QWidget* parent)
+ void ScanFolderPrefPage::createWidget(TQWidget* tqparent)
{
- m_widget = new ScanFolderPrefPageWidget(parent);
+ m_widget = new ScanFolderPrefPageWidget(tqparent);
}
void ScanFolderPrefPage::updateData()
diff --git a/plugins/scanfolder/scanfolderprefpage.h b/plugins/scanfolder/scanfolderprefpage.h
index 539a5fe..e09210b 100644
--- a/plugins/scanfolder/scanfolderprefpage.h
+++ b/plugins/scanfolder/scanfolderprefpage.h
@@ -39,7 +39,7 @@ namespace kt
virtual ~ScanFolderPrefPage();
virtual bool apply();
- virtual void createWidget(QWidget* parent);
+ virtual void createWidget(TQWidget* tqparent);
virtual void updateData();
virtual void deleteWidget();
diff --git a/plugins/scanfolder/scanfolderprefpagewidget.cpp b/plugins/scanfolder/scanfolderprefpagewidget.cpp
index b577a88..b1a6125 100644
--- a/plugins/scanfolder/scanfolderprefpagewidget.cpp
+++ b/plugins/scanfolder/scanfolderprefpagewidget.cpp
@@ -20,10 +20,10 @@
#include "scanfolderprefpagewidget.h"
#include "scanfolderpluginsettings.h"
-#include <qwidget.h>
-#include <qstring.h>
-#include <qcheckbox.h>
-#include <qfile.h>
+#include <tqwidget.h>
+#include <tqstring.h>
+#include <tqcheckbox.h>
+#include <tqfile.h>
#include <kglobal.h>
#include <klocale.h>
@@ -32,8 +32,8 @@
namespace kt
{
- ScanFolderPrefPageWidget::ScanFolderPrefPageWidget(QWidget *parent, const char *name)
- :SfPrefPageWidgetBase(parent, name)
+ ScanFolderPrefPageWidget::ScanFolderPrefPageWidget(TQWidget *tqparent, const char *name)
+ :SfPrefPageWidgetBase(tqparent, name)
{
use1->setChecked(ScanFolderPluginSettings::useFolder1());
use2->setChecked(ScanFolderPluginSettings::useFolder2());
@@ -58,9 +58,9 @@ namespace kt
bool usesf2 = use2->isChecked();
bool usesf3 = use3->isChecked();
- QString sfPath1 = url1->url();
- QString sfPath2 = url2->url();
- QString sfPath3 = url3->url();
+ TQString sfPath1 = url1->url();
+ TQString sfPath2 = url2->url();
+ TQString sfPath3 = url3->url();
bool silently = openSilently->isChecked();
bool deleteChecked = deleteCheck->isChecked();
@@ -70,26 +70,26 @@ namespace kt
ScanFolderPluginSettings::setActionDelete(deleteChecked);
ScanFolderPluginSettings::setActionMove(moveChecked);
- QString message = i18n( "ScanFolder - Folder %1: Invalid URL or folder does not exist. Please, choose a valid directory." );
- if(!QFile::exists(sfPath1) && usesf1)
+ TQString message = i18n( "ScanFolder - Folder %1: Invalid URL or folder does not exist. Please, choose a valid directory." );
+ if(!TQFile::exists(sfPath1) && usesf1)
{
- KMessageBox::sorry(0, message.arg( 1 ) );
+ KMessageBox::sorry(0, message.tqarg( 1 ) );
usesf1 = false;
}
else
ScanFolderPluginSettings::setFolder1(sfPath1);
- if(!QFile::exists(sfPath2) && usesf2)
+ if(!TQFile::exists(sfPath2) && usesf2)
{
- KMessageBox::sorry(0, message.arg( 2 ) );
+ KMessageBox::sorry(0, message.tqarg( 2 ) );
usesf2 = false;
}
else
ScanFolderPluginSettings::setFolder2(sfPath2);
- if(!QFile::exists(sfPath3) && usesf3)
+ if(!TQFile::exists(sfPath3) && usesf3)
{
- KMessageBox::sorry(0, message.arg( 3 ) );
+ KMessageBox::sorry(0, message.tqarg( 3 ) );
usesf3 = false;
}
else
diff --git a/plugins/scanfolder/scanfolderprefpagewidget.h b/plugins/scanfolder/scanfolderprefpagewidget.h
index 480b3b0..6419e1c 100644
--- a/plugins/scanfolder/scanfolderprefpagewidget.h
+++ b/plugins/scanfolder/scanfolderprefpagewidget.h
@@ -27,8 +27,9 @@ namespace kt
class ScanFolderPrefPageWidget: public SfPrefPageWidgetBase
{
Q_OBJECT
+ TQ_OBJECT
public:
- ScanFolderPrefPageWidget(QWidget *parent = 0, const char *name = 0);
+ ScanFolderPrefPageWidget(TQWidget *tqparent = 0, const char *name = 0);
void apply();
};
diff --git a/plugins/scanfolder/sfprefwidgetbase.ui b/plugins/scanfolder/sfprefwidgetbase.ui
index 8b2c83a..a6263be 100644
--- a/plugins/scanfolder/sfprefwidgetbase.ui
+++ b/plugins/scanfolder/sfprefwidgetbase.ui
@@ -1,6 +1,6 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>SfPrefPageWidgetBase</class>
-<widget class="QWidget">
+<widget class="TQWidget">
<property name="name">
<cstring>SfPrefPageWidgetBase</cstring>
</property>
@@ -19,15 +19,15 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
- <widget class="QLayoutWidget" row="0" column="0">
+ <widget class="TQLayoutWidget" row="0" column="0">
<property name="name">
- <cstring>layout16</cstring>
+ <cstring>tqlayout16</cstring>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
- <widget class="QCheckBox">
+ <widget class="TQCheckBox">
<property name="name">
<cstring>use1</cstring>
</property>
@@ -38,7 +38,7 @@
<string>Alt+1</string>
</property>
</widget>
- <widget class="QCheckBox">
+ <widget class="TQCheckBox">
<property name="name">
<cstring>use2</cstring>
</property>
@@ -49,7 +49,7 @@
<string>Alt+2</string>
</property>
</widget>
- <widget class="QCheckBox">
+ <widget class="TQCheckBox">
<property name="name">
<cstring>use3</cstring>
</property>
@@ -62,7 +62,7 @@
</widget>
</vbox>
</widget>
- <widget class="QButtonGroup" row="3" column="0">
+ <widget class="TQButtonGroup" row="3" column="0">
<property name="name">
<cstring>buttonGroup1</cstring>
</property>
@@ -73,7 +73,7 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
- <widget class="QCheckBox" row="2" column="0">
+ <widget class="TQCheckBox" row="2" column="0">
<property name="name">
<cstring>moveCheck</cstring>
</property>
@@ -84,7 +84,7 @@
<string>Move torrent to "loaded" directory after loading it</string>
</property>
</widget>
- <widget class="QCheckBox" row="0" column="0">
+ <widget class="TQCheckBox" row="0" column="0">
<property name="name">
<cstring>openSilently</cstring>
</property>
@@ -95,7 +95,7 @@
<string>Do not show 'Select files to download' dialog</string>
</property>
</widget>
- <widget class="QCheckBox" row="1" column="0">
+ <widget class="TQCheckBox" row="1" column="0">
<property name="name">
<cstring>deleteCheck</cstring>
</property>
@@ -108,7 +108,7 @@
</widget>
</grid>
</widget>
- <widget class="QGroupBox" row="2" column="0">
+ <widget class="TQGroupBox" row="2" column="0">
<property name="name">
<cstring>groupBox9</cstring>
</property>
@@ -143,7 +143,7 @@
<bool>false</bool>
</property>
</widget>
- <widget class="QLabel" row="0" column="0">
+ <widget class="TQLabel" row="0" column="0">
<property name="name">
<cstring>textLabel1</cstring>
</property>
@@ -154,7 +154,7 @@
<cstring>kURLRequester1</cstring>
</property>
</widget>
- <widget class="QLabel" row="1" column="0">
+ <widget class="TQLabel" row="1" column="0">
<property name="name">
<cstring>textLabel2</cstring>
</property>
@@ -165,7 +165,7 @@
<cstring>kURLRequester4</cstring>
</property>
</widget>
- <widget class="QLabel" row="2" column="0">
+ <widget class="TQLabel" row="2" column="0">
<property name="name">
<cstring>textLabel3</cstring>
</property>
@@ -188,7 +188,7 @@
<property name="sizeType">
<enum>Fixed</enum>
</property>
- <property name="sizeHint">
+ <property name="tqsizeHint">
<size>
<width>20</width>
<height>20</height>
@@ -205,7 +205,7 @@
<property name="sizeType">
<enum>Expanding</enum>
</property>
- <property name="sizeHint">
+ <property name="tqsizeHint">
<size>
<width>20</width>
<height>90</height>
@@ -257,7 +257,7 @@
<tabstop>deleteCheck</tabstop>
<tabstop>moveCheck</tabstop>
</tabstops>
-<layoutdefaults spacing="6" margin="11"/>
+<tqlayoutdefaults spacing="6" margin="11"/>
<includehints>
<includehint>kurlrequester.h</includehint>
<includehint>klineedit.h</includehint>