diff options
Diffstat (limited to 'akregator/src/akregator_part.cpp')
-rw-r--r-- | akregator/src/akregator_part.cpp | 220 |
1 files changed, 110 insertions, 110 deletions
diff --git a/akregator/src/akregator_part.cpp b/akregator/src/akregator_part.cpp index b5392c791..449b871e7 100644 --- a/akregator/src/akregator_part.cpp +++ b/akregator/src/akregator_part.cpp @@ -49,11 +49,11 @@ #include <kparts/genericfactory.h> #include <kparts/partmanager.h> -#include <qfile.h> -#include <qobjectlist.h> -#include <qstringlist.h> -#include <qtimer.h> -#include <qwidgetlist.h> +#include <tqfile.h> +#include <tqobjectlist.h> +#include <tqstringlist.h> +#include <tqtimer.h> +#include <tqwidgetlist.h> #include <private/qucomextra_p.h> #include <cerrno> @@ -116,8 +116,8 @@ class Part::ApplyFiltersInterceptor : public ArticleInterceptor } }; -Part::Part( QWidget *parentWidget, const char * /*widgetName*/, - QObject *parent, const char *name, const QStringList& ) +Part::Part( TQWidget *parentWidget, const char * /*widgetName*/, + TQObject *parent, const char *name, const TQStringList& ) : DCOPObject("AkregatorIface") , MyBasePart(parent, name) , m_standardListLoaded(false) @@ -144,9 +144,9 @@ Part::Part( QWidget *parentWidget, const char * /*widgetName*/, m_storage = 0; Backend::StorageFactory* factory = Backend::StorageFactoryRegistry::self()->getFactory(Settings::archiveBackend()); - QStringList storageParams; + TQStringList storageParams; - storageParams.append(QString("taggingEnabled=%1").arg(Settings::showTaggingGUI() ? "true" : "false")); + storageParams.append(TQString("taggingEnabled=%1").arg(Settings::showTaggingGUI() ? "true" : "false")); if (factory != 0) { @@ -193,12 +193,12 @@ Part::Part( QWidget *parentWidget, const char * /*widgetName*/, m_extension = new BrowserExtension(this, "ak_extension"); - connect(m_view, SIGNAL(setWindowCaption(const QString&)), this, SIGNAL(setWindowCaption(const QString&))); - connect(m_view, SIGNAL(setStatusBarText(const QString&)), this, SIGNAL(setStatusBarText(const QString&))); - connect(m_view, SIGNAL(setProgress(int)), m_extension, SIGNAL(loadingProgress(int))); - connect(m_view, SIGNAL(signalCanceled(const QString&)), this, SIGNAL(canceled(const QString&))); - connect(m_view, SIGNAL(signalStarted(KIO::Job*)), this, SIGNAL(started(KIO::Job*))); - connect(m_view, SIGNAL(signalCompleted()), this, SIGNAL(completed())); + connect(m_view, TQT_SIGNAL(setWindowCaption(const TQString&)), this, TQT_SIGNAL(setWindowCaption(const TQString&))); + connect(m_view, TQT_SIGNAL(setStatusBarText(const TQString&)), this, TQT_SIGNAL(setStatusBarText(const TQString&))); + connect(m_view, TQT_SIGNAL(setProgress(int)), m_extension, TQT_SIGNAL(loadingProgress(int))); + connect(m_view, TQT_SIGNAL(signalCanceled(const TQString&)), this, TQT_SIGNAL(canceled(const TQString&))); + connect(m_view, TQT_SIGNAL(signalStarted(KIO::Job*)), this, TQT_SIGNAL(started(KIO::Job*))); + connect(m_view, TQT_SIGNAL(signalCompleted()), this, TQT_SIGNAL(completed())); // notify the part that this is our internal widget setWidget(m_view); @@ -207,7 +207,7 @@ Part::Part( QWidget *parentWidget, const char * /*widgetName*/, TrayIcon::setInstance(trayIcon); m_actionManager->initTrayIcon(trayIcon); - connect(trayIcon, SIGNAL(showPart()), this, SIGNAL(showPart())); + connect(trayIcon, TQT_SIGNAL(showPart()), this, TQT_SIGNAL(showPart())); if ( isTrayIconEnabled() ) { @@ -217,22 +217,22 @@ Part::Part( QWidget *parentWidget, const char * /*widgetName*/, else NotificationManager::self()->setWidget(getMainWindow(), instance()); - connect( trayIcon, SIGNAL(quitSelected()), - kapp, SLOT(quit())) ; + connect( trayIcon, TQT_SIGNAL(quitSelected()), + kapp, TQT_SLOT(quit())) ; - connect( m_view, SIGNAL(signalUnreadCountChanged(int)), trayIcon, SLOT(slotSetUnread(int)) ); + connect( m_view, TQT_SIGNAL(signalUnreadCountChanged(int)), trayIcon, TQT_SLOT(slotSetUnread(int)) ); - connect(kapp, SIGNAL(shutDown()), this, SLOT(slotOnShutdown())); + connect(kapp, TQT_SIGNAL(shutDown()), this, TQT_SLOT(slotOnShutdown())); - m_autosaveTimer = new QTimer(this); - connect(m_autosaveTimer, SIGNAL(timeout()), this, SLOT(slotSaveFeedList())); + m_autosaveTimer = new TQTimer(this); + connect(m_autosaveTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(slotSaveFeedList())); m_autosaveTimer->start(5*60*1000); // 5 minutes setXMLFile("akregator_part.rc", true); initFonts(); - RSS::FileRetriever::setUserAgent(QString("Akregator/%1; librss/remnants").arg(AKREGATOR_VERSION)); + RSS::FileRetriever::setUserAgent(TQString("Akregator/%1; librss/remnants").arg(AKREGATOR_VERSION)); } void Part::loadPlugins() @@ -252,7 +252,7 @@ void Part::slotOnShutdown() { m_shuttingDown = true; - const QString lockLocation = locateLocal("data", "akregator/lock"); + const TQString lockLocation = locateLocal("data", "akregator/lock"); KSimpleConfig config(lockLocation); config.writeEntry("pid", -1); config.sync(); @@ -276,7 +276,7 @@ void Part::slotSettingsChanged() RSS::FileRetriever::setUseCache(Settings::useHTMLCache()); - QStringList fonts; + TQStringList fonts; fonts.append(Settings::standardFont()); fonts.append(Settings::fixedFont()); fonts.append(Settings::sansSerifFont()); @@ -338,56 +338,56 @@ void Part::openStandardFeedList() m_standardListLoaded = true; } -QDomDocument Part::createDefaultFeedList() +TQDomDocument Part::createDefaultFeedList() { - QDomDocument doc; - QDomProcessingInstruction z = doc.createProcessingInstruction("xml","version=\"1.0\" encoding=\"UTF-8\""); + TQDomDocument doc; + TQDomProcessingInstruction z = doc.createProcessingInstruction("xml","version=\"1.0\" encoding=\"UTF-8\""); doc.appendChild( z ); - QDomElement root = doc.createElement( "opml" ); + TQDomElement root = doc.createElement( "opml" ); root.setAttribute("version","1.0"); doc.appendChild( root ); - QDomElement head = doc.createElement( "head" ); + TQDomElement head = doc.createElement( "head" ); root.appendChild(head); - QDomElement text = doc.createElement( "text" ); + TQDomElement text = doc.createElement( "text" ); text.appendChild(doc.createTextNode(i18n("Feeds"))); head.appendChild(text); - QDomElement body = doc.createElement( "body" ); + TQDomElement body = doc.createElement( "body" ); root.appendChild(body); - QDomElement mainFolder = doc.createElement( "outline" ); + TQDomElement mainFolder = doc.createElement( "outline" ); mainFolder.setAttribute("text","KDE"); body.appendChild(mainFolder); - QDomElement ak = doc.createElement( "outline" ); + TQDomElement ak = doc.createElement( "outline" ); ak.setAttribute("text",i18n("Akregator News")); ak.setAttribute("xmlUrl","http://akregator.sf.net/rss2.php"); mainFolder.appendChild(ak); - QDomElement akb = doc.createElement( "outline" ); + TQDomElement akb = doc.createElement( "outline" ); akb.setAttribute("text",i18n("Akregator Blog")); akb.setAttribute("xmlUrl","http://akregator.pwsp.net/blog/?feed=rss2"); mainFolder.appendChild(akb); - QDomElement dot = doc.createElement( "outline" ); + TQDomElement dot = doc.createElement( "outline" ); dot.setAttribute("text",i18n("KDE Dot News")); dot.setAttribute("xmlUrl","http://www.kde.org/dotkdeorg.rdf"); mainFolder.appendChild(dot); - QDomElement plan = doc.createElement( "outline" ); + TQDomElement plan = doc.createElement( "outline" ); plan.setAttribute("text",i18n("Planet KDE")); plan.setAttribute("xmlUrl","http://planetkde.org/rss20.xml"); mainFolder.appendChild(plan); - QDomElement apps = doc.createElement( "outline" ); + TQDomElement apps = doc.createElement( "outline" ); apps.setAttribute("text",i18n("KDE Apps")); apps.setAttribute("xmlUrl","http://www.kde.org/dot/kde-apps-content.rdf"); mainFolder.appendChild(apps); - QDomElement look = doc.createElement( "outline" ); + TQDomElement look = doc.createElement( "outline" ); look.setAttribute("text",i18n("KDE Look")); look.setAttribute("xmlUrl","http://www.kde.org/kde-look-content.rdf"); mainFolder.appendChild(look); @@ -399,14 +399,14 @@ bool Part::openFile() { emit setStatusBarText(i18n("Opening Feed List...") ); - QString str; - // m_file is always local so we can use QFile on it - QFile file(m_file); + TQString str; + // m_file is always local so we can use TQFile on it + TQFile file(m_file); bool fileExists = file.exists(); - QString listBackup = m_storage->restoreFeedList(); + TQString listBackup = m_storage->restoreFeedList(); - QDomDocument doc; + TQDomDocument doc; if (!fileExists) { @@ -417,8 +417,8 @@ bool Part::openFile() if (file.open(IO_ReadOnly)) { // Read OPML feeds list and build QDom tree. - QTextStream stream(&file); - stream.setEncoding(QTextStream::UnicodeUTF8); // FIXME not all opmls are in utf8 + TQTextStream stream(&file); + stream.setEncoding(TQTextStream::UnicodeUTF8); // FIXME not all opmls are in utf8 str = stream.read(); file.close(); } @@ -428,7 +428,7 @@ bool Part::openFile() if (file.size() > 0) // don't backup empty files { - QString backup = m_file + "-backup." + QString::number(QDateTime::currentDateTime().toTime_t()); + TQString backup = m_file + "-backup." + TQString::number(TQDateTime::currentDateTime().toTime_t()); copyFile(backup); @@ -444,7 +444,7 @@ bool Part::openFile() { if (file.size() > 0) // don't backup empty files { - QString backup = m_file + "-backup." + QString::number(QDateTime::currentDateTime().toTime_t()); + TQString backup = m_file + "-backup." + TQString::number(TQDateTime::currentDateTime().toTime_t()); copyFile(backup); KMessageBox::error(m_view, i18n("<qt>The standard feed list is corrupted (no valid OPML). A backup was created:<p><b>%2</b></p></qt>").arg(backup), i18n("OPML Parsing Error") ); @@ -452,7 +452,7 @@ bool Part::openFile() m_view->loadFeeds(createDefaultFeedList()); } - emit setStatusBarText(QString::null); + emit setStatusBarText(TQString::null); if( Settings::markAllFeedsReadOnStartup() ) @@ -473,16 +473,16 @@ void Part::slotSaveFeedList() // the first time we overwrite the feed list, we create a backup if (!m_backedUpList) { - QString backup = m_file + "~"; + TQString backup = m_file + "~"; if (copyFile(backup)) m_backedUpList = true; } - QString xmlStr = m_view->feedListToOPML().toString(); + TQString xmlStr = m_view->feedListToOPML().toString(); m_storage->storeFeedList(xmlStr); - QFile file(m_file); + TQFile file(m_file); if (file.open(IO_WriteOnly) == false) { //FIXME: allow to save the feedlist into different location -tpr 20041118 @@ -490,9 +490,9 @@ void Part::slotSaveFeedList() return; } - // use QTextStream to dump the text to the file - QTextStream stream(&file); - stream.setEncoding(QTextStream::UnicodeUTF8); + // use TQTextStream to dump the text to the file + TQTextStream stream(&file); + stream.setEncoding(TQTextStream::UnicodeUTF8); // Write OPML data file. // Archive data files are saved elsewhere. @@ -534,31 +534,31 @@ bool Part::mergePart(KParts::Part* part) return true; } -QWidget* Part::getMainWindow() +TQWidget* Part::getMainWindow() { // this is a dirty fix to get the main window used for the tray icon - QWidgetList *l = kapp->topLevelWidgets(); - QWidgetListIt it( *l ); - QWidget *wid; + TQWidgetList *l = kapp->topLevelWidgets(); + TQWidgetListIt it( *l ); + TQWidget *wid; // check if there is an akregator main window while ( (wid = it.current()) != 0 ) { ++it; //kdDebug() << "win name: " << wid->name() << endl; - if (QString(wid->name()) == "akregator_mainwindow") + if (TQString(wid->name()) == "akregator_mainwindow") { delete l; return wid; } } // if not, check for kontact main window - QWidgetListIt it2( *l ); + TQWidgetListIt it2( *l ); while ( (wid = it2.current()) != 0 ) { ++it2; - if (QString(wid->name()).startsWith("kontact-mainwindow")) + if (TQString(wid->name()).startsWith("kontact-mainwindow")) { delete l; return wid; @@ -568,11 +568,11 @@ QWidget* Part::getMainWindow() return 0; } -void Part::loadTagSet(const QString& path) +void Part::loadTagSet(const TQString& path) { - QDomDocument doc; + TQDomDocument doc; - QFile file(path); + TQFile file(path); if (file.open(IO_ReadOnly)) { doc.setContent(file.readAll()); @@ -594,19 +594,19 @@ void Part::loadTagSet(const QString& path) } } -void Part::saveTagSet(const QString& path) +void Part::saveTagSet(const TQString& path) { - QString xmlStr = Kernel::self()->tagSet()->toXML().toString(); + TQString xmlStr = Kernel::self()->tagSet()->toXML().toString(); m_storage->storeTagSet(xmlStr); - QFile file(path); + TQFile file(path); if ( file.open(IO_WriteOnly) ) { - QTextStream stream(&file); - stream.setEncoding(QTextStream::UnicodeUTF8); + TQTextStream stream(&file); + stream.setEncoding(TQTextStream::UnicodeUTF8); stream << xmlStr << "\n"; file.close(); } @@ -614,7 +614,7 @@ void Part::saveTagSet(const QString& path) void Part::importFile(const KURL& url) { - QString filename; + TQString filename; bool isRemote = false; @@ -631,11 +631,11 @@ void Part::importFile(const KURL& url) } } - QFile file(filename); + TQFile file(filename); if (file.open(IO_ReadOnly)) { // Read OPML feeds list and build QDom tree. - QDomDocument doc; + TQDomDocument doc; if (doc.setContent(file.readAll())) m_view->importFeeds(doc); else @@ -652,7 +652,7 @@ void Part::exportFile(const KURL& url) { if (url.isLocalFile()) { - QFile file(url.path()); + TQFile file(url.path()); if ( file.exists() && KMessageBox::questionYesNo(m_view, @@ -668,8 +668,8 @@ void Part::exportFile(const KURL& url) return; } - QTextStream stream(&file); - stream.setEncoding(QTextStream::UnicodeUTF8); + TQTextStream stream(&file); + stream.setEncoding(TQTextStream::UnicodeUTF8); stream << m_view->feedListToOPML().toString() << "\n"; file.close(); @@ -679,8 +679,8 @@ void Part::exportFile(const KURL& url) KTempFile tmpfile; tmpfile.setAutoDelete(true); - QTextStream stream(tmpfile.file()); - stream.setEncoding(QTextStream::UnicodeUTF8); + TQTextStream stream(tmpfile.file()); + stream.setEncoding(TQTextStream::UnicodeUTF8); stream << m_view->feedListToOPML().toString() << "\n"; tmpfile.close(); @@ -692,7 +692,7 @@ void Part::exportFile(const KURL& url) void Part::fileImport() { - KURL url = KFileDialog::getOpenURL( QString::null, + KURL url = KFileDialog::getOpenURL( TQString::null, "*.opml *.xml|" + i18n("OPML Outlines (*.opml, *.xml)") +"\n*|" + i18n("All Files") ); @@ -702,7 +702,7 @@ void Part::fileImport() void Part::fileExport() { - KURL url= KFileDialog::getSaveURL( QString::null, + KURL url= KFileDialog::getSaveURL( TQString::null, "*.opml *.xml|" + i18n("OPML Outlines (*.opml, *.xml)") +"\n*|" + i18n("All Files") ); @@ -720,7 +720,7 @@ void Part::fileGetFeeds() void Part::fileSendArticle(bool attach) { // FIXME: you have to open article to tab to be able to send... - QString title, text; + TQString title, text; text = m_view->currentFrame()->part()->url().prettyURL(); if(text.isEmpty() || text.isNull()) @@ -751,14 +751,14 @@ void Part::fetchAllFeeds() m_view->slotFetchAllFeeds(); } -void Part::fetchFeedUrl(const QString&s) +void Part::fetchFeedUrl(const TQString&s) { kdDebug() << "fetchFeedURL==" << s << endl; } -void Part::addFeedsToGroup(const QStringList& urls, const QString& group) +void Part::addFeedsToGroup(const TQStringList& urls, const TQString& group) { - for (QStringList::ConstIterator it = urls.begin(); it != urls.end(); ++it) + for (TQStringList::ConstIterator it = urls.begin(); it != urls.end(); ++it) { kdDebug() << "Akregator::Part::addFeedToGroup adding feed with URL " << *it << " to group " << group << endl; m_view->addFeedToGroup(*it, group); @@ -790,10 +790,10 @@ void Part::showOptions() KConfigDialog* dialog = new ConfigDialog( m_view, "settings", Settings::self() ); - connect( dialog, SIGNAL(settingsChanged()), - this, SLOT(slotSettingsChanged()) ); - connect( dialog, SIGNAL(settingsChanged()), - TrayIcon::getInstance(), SLOT(settingsChanged()) ); + connect( dialog, TQT_SIGNAL(settingsChanged()), + this, TQT_SLOT(slotSettingsChanged()) ); + connect( dialog, TQT_SIGNAL(settingsChanged()), + TrayIcon::getInstance(), TQT_SLOT(settingsChanged()) ); dialog->show(); } @@ -811,10 +811,10 @@ void Part::partActivateEvent(KParts::PartActivateEvent* event) MyBasePart::partActivateEvent(event); } -KParts::Part* Part::hitTest(QWidget *widget, const QPoint &globalPos) +KParts::Part* Part::hitTest(TQWidget *widget, const TQPoint &globalPos) { bool child = false; - QWidget *me = this->widget(); + TQWidget *me = this->widget(); while (widget) { if (widget == me) { child = true; @@ -834,7 +834,7 @@ KParts::Part* Part::hitTest(QWidget *widget, const QPoint &globalPos) void Part::initFonts() { - QStringList fonts = Settings::fonts(); + TQStringList fonts = Settings::fonts(); if (fonts.isEmpty()) { fonts.append(KGlobalSettings::generalFont().family()); @@ -893,17 +893,17 @@ void Part::initFonts() } -bool Part::copyFile(const QString& backup) +bool Part::copyFile(const TQString& backup) { - QFile file(m_file); + TQFile file(m_file); if (file.open(IO_ReadOnly)) { - QFile backupFile(backup); + TQFile backupFile(backup); if (backupFile.open(IO_WriteOnly)) { - QTextStream in(&file); - QTextStream out(&backupFile); + TQTextStream in(&file); + TQTextStream out(&backupFile); while (!in.atEnd()) out << in.readLine(); backupFile.close(); @@ -919,7 +919,7 @@ bool Part::copyFile(const QString& backup) return false; } -static QString getMyHostName() +static TQString getMyHostName() { char hostNameC[256]; // null terminate this C string @@ -927,31 +927,31 @@ static QString getMyHostName() // set the string to 0 length if gethostname fails if(gethostname(hostNameC, 255)) hostNameC[0] = 0; - return QString::fromLocal8Bit(hostNameC); + return TQString::fromLocal8Bit(hostNameC); } // taken from KMail -bool Part::tryToLock(const QString& backendName) +bool Part::tryToLock(const TQString& backendName) { // Check and create a lock file to prevent concurrent access to metakit archive - QString appName = kapp->instanceName(); + TQString appName = kapp->instanceName(); if ( appName.isEmpty() ) appName = "akregator"; - QString programName; + TQString programName; const KAboutData *about = kapp->aboutData(); if ( about ) programName = about->programName(); if ( programName.isEmpty() ) programName = i18n("Akregator"); - QString lockLocation = locateLocal("data", "akregator/lock"); + TQString lockLocation = locateLocal("data", "akregator/lock"); KSimpleConfig config(lockLocation); int oldPid = config.readNumEntry("pid", -1); - const QString oldHostName = config.readEntry("hostname"); - const QString oldAppName = config.readEntry( "appName", appName ); - const QString oldProgramName = config.readEntry( "programName", programName ); - const QString hostName = getMyHostName(); + const TQString oldHostName = config.readEntry("hostname"); + const TQString oldAppName = config.readEntry( "appName", appName ); + const TQString oldProgramName = config.readEntry( "programName", programName ); + const TQString hostName = getMyHostName(); bool first_instance = false; if ( oldPid == -1 ) first_instance = true; @@ -965,7 +965,7 @@ bool Part::tryToLock(const QString& backendName) if ( !first_instance ) { - QString msg; + TQString msg; if ( oldHostName == hostName ) { // this can only happen if the user is running this application on @@ -979,8 +979,8 @@ bool Part::tryToLock(const QString& backendName) "You should disable the archive for now " "unless you are sure that %2 is not already running.</qt>") .arg( programName, programName, backendName ); - // QString::arg( st ) only replaces the first occurrence of %1 - // with st while QString::arg( s1, s2 ) replacess all occurrences + // TQString::arg( st ) only replaces the first occurrence of %1 + // with st while TQString::arg( s1, s2 ) replacess all occurrences // of %1 with s1 and all occurrences of %2 with s2. So don't // even think about changing the above to .arg( programName ). else @@ -1014,7 +1014,7 @@ bool Part::tryToLock(const QString& backendName) KCursorSaver idle( KBusyPtr::idle() ); if ( KMessageBox::No == - KMessageBox::warningYesNo( 0, msg, QString::null, + KMessageBox::warningYesNo( 0, msg, TQString::null, i18n("Force Access"), i18n("Disable Archive")) ) { |