summaryrefslogtreecommitdiffstats
path: root/kontact/plugins/newsticker
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit460c52653ab0dcca6f19a4f492ed2c5e4e963ab0 (patch)
tree67208f7c145782a7e90b123b982ca78d88cc2c87 /kontact/plugins/newsticker
downloadtdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.tar.gz
tdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kontact/plugins/newsticker')
-rw-r--r--kontact/plugins/newsticker/Makefile.am26
-rw-r--r--kontact/plugins/newsticker/kcmkontactknt.cpp452
-rw-r--r--kontact/plugins/newsticker/kcmkontactknt.desktop156
-rw-r--r--kontact/plugins/newsticker/kcmkontactknt.h102
-rw-r--r--kontact/plugins/newsticker/newsfeeds.h315
-rw-r--r--kontact/plugins/newsticker/newsticker_plugin.cpp43
-rw-r--r--kontact/plugins/newsticker/newsticker_plugin.h40
-rw-r--r--kontact/plugins/newsticker/newstickerplugin.desktop99
-rw-r--r--kontact/plugins/newsticker/summarywidget.cpp319
-rw-r--r--kontact/plugins/newsticker/summarywidget.h115
10 files changed, 1667 insertions, 0 deletions
diff --git a/kontact/plugins/newsticker/Makefile.am b/kontact/plugins/newsticker/Makefile.am
new file mode 100644
index 000000000..779936802
--- /dev/null
+++ b/kontact/plugins/newsticker/Makefile.am
@@ -0,0 +1,26 @@
+INCLUDES = -I$(top_srcdir)/kontact/interfaces \
+ -I$(top_srcdir)/libkdepim \
+ -I$(top_srcdir) $(all_includes)
+
+kde_module_LTLIBRARIES = libkontact_newstickerplugin.la kcm_kontactknt.la
+libkontact_newstickerplugin_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkontact_newstickerplugin_la_LIBADD = $(LIB_KPARTS) $(LIB_KDEUI) \
+ $(top_builddir)/libkdepim/libkdepim.la ../../interfaces/libkpinterfaces.la
+
+libkontact_newstickerplugin_la_SOURCES = newsticker_plugin.cpp \
+ summarywidget.cpp summarywidget.skel
+
+kcm_kontactknt_la_SOURCES = kcmkontactknt.cpp
+kcm_kontactknt_la_LDFLAGS = -module $(KDE_PLUGIN) $(KDE_RPATH) $(all_libraries) \
+ -avoid-version -no-undefined
+kcm_kontactknt_la_LIBADD = $(LIB_KDEUI)
+
+METASOURCES = AUTO
+
+servicedir = $(kde_servicesdir)/kontact
+service_DATA = newstickerplugin.desktop
+
+kde_services_DATA = kcmkontactknt.desktop
+
+messages: rc.cpp
+ $(XGETTEXT) *.cpp -o $(podir)/kcmkontactnt.pot
diff --git a/kontact/plugins/newsticker/kcmkontactknt.cpp b/kontact/plugins/newsticker/kcmkontactknt.cpp
new file mode 100644
index 000000000..18f439c8e
--- /dev/null
+++ b/kontact/plugins/newsticker/kcmkontactknt.cpp
@@ -0,0 +1,452 @@
+/*
+ This file is part of Kontact.
+ Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ As a special exception, permission is given to link this program
+ with any edition of Qt, and distribute the resulting executable,
+ without including the source code for Qt in the source distribution.
+*/
+
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qlineedit.h>
+#include <qvaluevector.h>
+#include <qspinbox.h>
+
+#include <dcopref.h>
+#include <dcopclient.h>
+
+#include <kaboutdata.h>
+#include <kapplication.h>
+#include <kaccelmanager.h>
+#include <kconfig.h>
+#include <kdebug.h>
+#include <kdialogbase.h>
+#include <klistview.h>
+#include <klocale.h>
+#include <kpushbutton.h>
+
+#include "kcmkontactknt.h"
+
+#include "newsfeeds.h"
+
+#include <kdepimmacros.h>
+
+extern "C"
+{
+ KDE_EXPORT KCModule *create_kontactknt( QWidget *parent, const char * )
+ {
+ return new KCMKontactKNT( parent, "kcmkontactknt" );
+ }
+}
+
+NewsEditDialog::NewsEditDialog( const QString& title, const QString& url, QWidget *parent )
+ : KDialogBase( Plain, i18n( "New News Feed" ), Ok | Cancel,
+ Ok, parent, 0, true, true )
+{
+ QWidget *page = plainPage();
+ QGridLayout *layout = new QGridLayout( page, 2, 3, marginHint(),
+ spacingHint() );
+
+ QLabel *label = new QLabel( i18n( "Name:" ), page );
+ layout->addWidget( label, 0, 0 );
+
+ mTitle = new QLineEdit( page );
+ label->setBuddy( mTitle );
+ layout->addMultiCellWidget( mTitle, 0, 0, 1, 2 );
+
+ label = new QLabel( i18n( "URL:" ), page );
+ layout->addWidget( label, 1, 0 );
+
+ mURL = new QLineEdit( page );
+ label->setBuddy( mURL );
+ layout->addMultiCellWidget( mURL, 1, 1, 1, 2 );
+
+ mTitle->setText( title );
+ mURL->setText( url );
+ mTitle->setFocus();
+ connect( mTitle, SIGNAL( textChanged( const QString& ) ),
+ this, SLOT( modified() ) );
+ connect( mURL, SIGNAL( textChanged( const QString& ) ),
+ this, SLOT( modified() ) );
+
+ modified();
+}
+
+void NewsEditDialog::modified()
+{
+ enableButton( KDialogBase::Ok, !title().isEmpty() && !url().isEmpty() );
+}
+
+QString NewsEditDialog::title() const
+{
+ return mTitle->text();
+}
+
+QString NewsEditDialog::url() const
+{
+ return mURL->text();
+}
+
+class NewsItem : public QListViewItem
+{
+ public:
+ NewsItem( QListView *parent, const QString& title, const QString& url, bool custom )
+ : QListViewItem( parent ), mTitle( title ), mUrl( url ), mCustom( custom )
+ {
+ setText( 0, mTitle );
+ }
+
+ NewsItem( QListViewItem *parent, const QString& title, const QString& url, bool custom )
+ : QListViewItem( parent ), mTitle( title ), mUrl( url ), mCustom( custom )
+ {
+ setText( 0, mTitle );
+ }
+
+ QString title() const { return mTitle; }
+ QString url() const { return mUrl; }
+ bool custom() const { return mCustom; }
+
+ private:
+ QString mTitle;
+ QString mUrl;
+ bool mCustom;
+};
+
+KCMKontactKNT::KCMKontactKNT( QWidget *parent, const char *name )
+ : KCModule( parent, name )
+{
+ initGUI();
+
+ connect( mAllNews, SIGNAL( currentChanged( QListViewItem* ) ),
+ this, SLOT( allCurrentChanged( QListViewItem* ) ) );
+ connect( mSelectedNews, SIGNAL( selectionChanged( QListViewItem* ) ),
+ this, SLOT( selectedChanged( QListViewItem* ) ) );
+
+ connect( mUpdateInterval, SIGNAL( valueChanged( int ) ), SLOT( modified() ) );
+ connect( mArticleCount, SIGNAL( valueChanged( int ) ), SLOT( modified() ) );
+
+ connect( mAddButton, SIGNAL( clicked() ), this, SLOT( addNews() ) );
+ connect( mRemoveButton, SIGNAL( clicked() ), this, SLOT( removeNews() ) );
+ connect( mNewButton, SIGNAL( clicked() ), this, SLOT( newFeed() ) );
+ connect( mDeleteButton, SIGNAL( clicked() ), this, SLOT( deleteFeed() ) );
+
+ KAcceleratorManager::manage( this );
+
+ load();
+}
+
+void KCMKontactKNT::loadNews()
+{
+ QValueVector<QListViewItem*> parents;
+ QValueVector<QListViewItem*>::Iterator it;
+
+ parents.append( new QListViewItem( mAllNews, i18n( "Arts" ) ) );
+ parents.append( new QListViewItem( mAllNews, i18n( "Business" ) ) );
+ parents.append( new QListViewItem( mAllNews, i18n( "Computers" ) ) );
+ parents.append( new QListViewItem( mAllNews, i18n( "Misc" ) ) );
+ parents.append( new QListViewItem( mAllNews, i18n( "Recreation" ) ) );
+ parents.append( new QListViewItem( mAllNews, i18n( "Society" ) ) );
+
+ for ( it = parents.begin(); it != parents.end(); ++it )
+ (*it)->setSelectable( false );
+
+ for ( int i = 0; i < DEFAULT_NEWSSOURCES; ++i ) {
+ NewsSourceData data = NewsSourceDefault[ i ];
+ new NewsItem( parents[ data.category() ], data.name(), data.url(), false );
+ mFeedMap.insert( data.url(), data.name() );
+ }
+}
+
+void KCMKontactKNT::loadCustomNews()
+{
+ KConfig config( "kcmkontactkntrc" );
+ QMap<QString, QString> customFeeds = config.entryMap( "CustomFeeds" );
+ config.setGroup( "CustomFeeds" );
+
+ mCustomItem = new QListViewItem( mAllNews, i18n( "Custom" ) );
+ mCustomItem->setSelectable( false );
+
+ if ( customFeeds.count() == 0 )
+ mCustomItem->setVisible( false );
+
+ QMap<QString, QString>::Iterator it;
+ for ( it = customFeeds.begin(); it != customFeeds.end(); ++it ) {
+ QStringList value = config.readListEntry( it.key() );
+ mCustomFeeds.append( new NewsItem( mCustomItem, value[ 0 ], value[ 1 ], true ) );
+ mFeedMap.insert( value[ 1 ], value[ 0 ] );
+ mCustomItem->setVisible( true );
+ }
+}
+
+void KCMKontactKNT::storeCustomNews()
+{
+ KConfig config( "kcmkontactkntrc" );
+ config.deleteGroup( "CustomFeeds" );
+ config.setGroup( "CustomFeeds" );
+
+ int counter = 0;
+ QValueList<NewsItem*>::Iterator it;
+ for ( it = mCustomFeeds.begin(); it != mCustomFeeds.end(); ++it ) {
+ QStringList value;
+ value << (*it)->title() << (*it)->url();
+ config.writeEntry( QString::number( counter ), value );
+
+ ++counter;
+ }
+
+ config.sync();
+}
+
+void KCMKontactKNT::addNews()
+{
+ if ( !dcopActive() )
+ return;
+
+ NewsItem *item = dynamic_cast<NewsItem*>( mAllNews->selectedItem() );
+ if ( item == 0 )
+ return;
+
+ DCOPRef service( "rssservice", "RSSService" );
+ service.send( "add(QString)", item->url() );
+
+ scanNews();
+
+ emit changed( true );
+}
+
+void KCMKontactKNT::removeNews()
+{
+ if ( !dcopActive() )
+ return;
+
+ NewsItem *item = dynamic_cast<NewsItem*>( mSelectedNews->selectedItem() );
+ if ( item == 0 )
+ return;
+
+ DCOPRef service( "rssservice", "RSSService" );
+ service.send( "remove(QString)", item->url() );
+
+ scanNews();
+
+ emit changed( true );
+}
+
+void KCMKontactKNT::newFeed()
+{
+ NewsEditDialog dlg( "", "", this );
+
+ if ( dlg.exec() ) {
+ NewsItem *item = new NewsItem( mCustomItem, dlg.title(), dlg.url(), true );
+ mCustomFeeds.append( item );
+ mFeedMap.insert( dlg.url(), dlg.title() );
+
+ mCustomItem->setVisible( true );
+ mCustomItem->setOpen( true );
+ mAllNews->ensureItemVisible( item );
+ mAllNews->setSelected( item, true );
+
+ emit changed( true );
+ }
+}
+
+void KCMKontactKNT::deleteFeed()
+{
+ NewsItem *item = dynamic_cast<NewsItem*>( mAllNews->selectedItem() );
+ if ( !item )
+ return;
+
+ if ( mCustomFeeds.find( item ) == mCustomFeeds.end() )
+ return;
+
+ mCustomFeeds.remove( item );
+ mFeedMap.remove( item->url() );
+ delete item;
+
+ if ( mCustomFeeds.count() == 0 )
+ mCustomItem->setVisible( false );
+
+ emit changed( true );
+}
+
+void KCMKontactKNT::scanNews()
+{
+ if ( !dcopActive() )
+ return;
+
+ mSelectedNews->clear();
+
+ DCOPRef service( "rssservice", "RSSService" );
+ QStringList urls = service.call( "list()" );
+
+ for ( uint i = 0; i < urls.count(); ++i )
+ {
+ QString url = urls[ i ];
+ QString feedName = mFeedMap[ url ];
+ if ( feedName.isEmpty() )
+ feedName = url;
+ new NewsItem( mSelectedNews, feedName, url, false );
+ }
+}
+
+void KCMKontactKNT::selectedChanged( QListViewItem *item )
+{
+ mRemoveButton->setEnabled( item && item->isSelected() );
+}
+
+void KCMKontactKNT::allCurrentChanged( QListViewItem *item )
+{
+ NewsItem *newsItem = dynamic_cast<NewsItem*>( item );
+
+ bool addState = false;
+ bool delState = false;
+ if ( newsItem && newsItem->isSelected() ) {
+ addState = true;
+ delState = (mCustomFeeds.find( newsItem ) != mCustomFeeds.end());
+ }
+
+ mAddButton->setEnabled( addState );
+ mDeleteButton->setEnabled( delState );
+}
+
+void KCMKontactKNT::modified()
+{
+ emit changed( true );
+}
+
+void KCMKontactKNT::initGUI()
+{
+ QGridLayout *layout = new QGridLayout( this, 2, 3, KDialog::marginHint(),
+ KDialog::spacingHint() );
+
+ mAllNews = new KListView( this );
+ mAllNews->addColumn( i18n( "All" ) );
+ mAllNews->setRootIsDecorated( true );
+ mAllNews->setFullWidth( true );
+ layout->addWidget( mAllNews, 0, 0 );
+
+ QVBoxLayout *vbox = new QVBoxLayout( layout, KDialog::spacingHint() );
+
+ vbox->addStretch();
+ mAddButton = new KPushButton( i18n( "Add" ), this );
+ mAddButton->setEnabled( false );
+ vbox->addWidget( mAddButton );
+ mRemoveButton = new KPushButton( i18n( "Remove" ), this );
+ mRemoveButton->setEnabled( false );
+ vbox->addWidget( mRemoveButton );
+ vbox->addStretch();
+
+ mSelectedNews = new KListView( this );
+ mSelectedNews->addColumn( i18n( "Selected" ) );
+ mSelectedNews->setFullWidth( true );
+ layout->addWidget( mSelectedNews, 0, 2 );
+
+ QGroupBox *box = new QGroupBox( 0, Qt::Vertical,
+ i18n( "News Feed Settings" ), this );
+
+ QGridLayout *boxLayout = new QGridLayout( box->layout(), 2, 3,
+ KDialog::spacingHint() );
+
+ QLabel *label = new QLabel( i18n( "Refresh time:" ), box );
+ boxLayout->addWidget( label, 0, 0 );
+
+ mUpdateInterval = new QSpinBox( 1, 3600, 1, box );
+ mUpdateInterval->setSuffix( " sec." );
+ label->setBuddy( mUpdateInterval );
+ boxLayout->addWidget( mUpdateInterval, 0, 1 );
+
+ label = new QLabel( i18n( "Number of items shown:" ), box );
+ boxLayout->addWidget( label, 1, 0 );
+
+ mArticleCount = new QSpinBox( box );
+ label->setBuddy( mArticleCount );
+ boxLayout->addWidget( mArticleCount, 1, 1 );
+
+ mNewButton = new KPushButton( i18n( "New Feed..." ), box );
+ boxLayout->addWidget( mNewButton, 0, 2 );
+
+ mDeleteButton = new KPushButton( i18n( "Delete Feed" ), box );
+ mDeleteButton->setEnabled( false );
+ boxLayout->addWidget( mDeleteButton, 1, 2 );
+
+ layout->addMultiCellWidget( box, 1, 1, 0, 2 );
+}
+
+bool KCMKontactKNT::dcopActive() const
+{
+ QString error;
+ QCString appID;
+ bool isGood = true;
+ DCOPClient *client = kapp->dcopClient();
+ if ( !client->isApplicationRegistered( "rssservice" ) ) {
+ if ( KApplication::startServiceByDesktopName( "rssservice", QStringList(), &error, &appID ) )
+ isGood = false;
+ }
+
+ return isGood;
+}
+
+void KCMKontactKNT::load()
+{
+ mAllNews->clear();
+
+ loadNews();
+ loadCustomNews();
+ scanNews();
+
+ KConfig config( "kcmkontactkntrc" );
+ config.setGroup( "General" );
+
+ mUpdateInterval->setValue( config.readNumEntry( "UpdateInterval", 600 ) );
+ mArticleCount->setValue( config.readNumEntry( "ArticleCount", 4 ) );
+
+ emit changed( false );
+}
+
+void KCMKontactKNT::save()
+{
+ storeCustomNews();
+
+ KConfig config( "kcmkontactkntrc" );
+ config.setGroup( "General" );
+
+ config.writeEntry( "UpdateInterval", mUpdateInterval->value() );
+ config.writeEntry( "ArticleCount", mArticleCount->value() );
+
+ config.sync();
+
+ emit changed( false );
+}
+
+void KCMKontactKNT::defaults()
+{
+}
+
+const KAboutData* KCMKontactKNT::aboutData() const
+{
+ KAboutData *about = new KAboutData( I18N_NOOP( "kcmkontactknt" ),
+ I18N_NOOP( "Newsticker Configuration Dialog" ),
+ 0, 0, KAboutData::License_GPL,
+ I18N_NOOP( "(c) 2003 - 2004 Tobias Koenig" ) );
+
+ about->addAuthor( "Tobias Koenig", 0, "tokoe@kde.org" );
+
+ return about;
+}
+
+#include "kcmkontactknt.moc"
diff --git a/kontact/plugins/newsticker/kcmkontactknt.desktop b/kontact/plugins/newsticker/kcmkontactknt.desktop
new file mode 100644
index 000000000..d866e252a
--- /dev/null
+++ b/kontact/plugins/newsticker/kcmkontactknt.desktop
@@ -0,0 +1,156 @@
+[Desktop Entry]
+Icon=knode
+Type=Service
+ServiceTypes=KCModule
+
+X-KDE-ModuleType=Library
+X-KDE-Library=kontactknt
+X-KDE-FactoryName=kontactknt
+X-KDE-ParentApp=kontact_newstickerplugin
+X-KDE-ParentComponents=kontact_newstickerplugin
+X-KDE-CfgDlgHierarchy=KontactSummary
+
+Name=News Ticker
+Name[af]=Nuus tikker
+Name[az]=Xəbər Gözləyici
+Name[br]=Kliker keleier
+Name[ca]=Teletip de notícies
+Name[cy]=Ticer Newyddion
+Name[da]=Nyhedstelegraf
+Name[de]=Newsticker
+Name[el]=Προβολέας ειδήσεων
+Name[eo]=Novaĵprezentilo
+Name[es]=Teletipo de noticias
+Name[et]=Uudistejälgija
+Name[eu]=Berri markatzailea
+Name[fa]=Ticker اخبار
+Name[fi]=Uutisnäytin
+Name[fr]=Téléscripteur de nouvelles
+Name[fy]=Nijs Tikker
+Name[gl]=Colector de Novas
+Name[he]=חדשות רצות
+Name[hi]=न्यूज टिकर
+Name[hr]=Ticker sa novostima
+Name[hu]=RSS hírmegjelenítő
+Name[id]=Ticker Berita
+Name[is]=Fréttastrimill
+Name[it]=Ticker notizie
+Name[ja]=ニュースティッカー
+Name[ka]=სიახლეთა ტიკერი
+Name[kk]=Жаңалық таспасы
+Name[km]=កម្មវិធី​ទទួល​ព័ត៌មាន
+Name[lt]=News pranešėjas
+Name[lv]=Ziņu Tikkers
+Name[ms]=Pengetik Berita
+Name[nb]=Nyhetstelegraf
+Name[nds]=Narichten-Ticker
+Name[ne]=न्यूज टिकर
+Name[nn]=Nyheitstelegraf
+Name[pl]=Wiadomości
+Name[pt]=Extractor de Notícias
+Name[pt_BR]=Animação de Notícias
+Name[ro]=Ştiri Internet
+Name[ru]=Новости
+Name[sk]=Sledovanie správ
+Name[sl]=Prikazovalnik novic
+Name[sr]=Откуцавач вести
+Name[sr@Latn]=Otkucavač vesti
+Name[sv]=Nyhetsövervakare
+Name[ta]=செய்திகள் குறிப்பான்
+Name[tg]=Ахборот
+Name[th]=ตั๋วข่าว
+Name[tr]=Haber İzleyici
+Name[uk]=Стрічка новин
+Name[ven]=Musengulusi wa Mafhungo
+Name[vi]=Trình kiểm tra news
+Name[xh]=Umchola-choli weendaba
+Name[zh_CN]=新闻点点通
+Name[zh_TW]=新聞顯示器
+Name[zu]=Umlungiseleli Wezindaba
+Comment=News Ticker Summary Setup
+Comment[af]=Nuus tikker opsomming opstelling
+Comment[bg]=Настройване обобщението на новините
+Comment[ca]=Configuració del resum del teletip de notícies
+Comment[cs]=Nastavení souhrnu newstickeru
+Comment[da]=Nyhedstelegrafs opsætning af opsummering
+Comment[de]=Einstellung der News-übersicht
+Comment[el]=Περίληψη ρύθμισης προβολέα ρυθμίσεων
+Comment[es]=Configuración del resumen del teletipo de noticias
+Comment[et]=Uudistejälgija kokkuvõtte seadistus
+Comment[eu]=Berri markatzailearen laburpenaren konfigurazioa
+Comment[fa]=برپایی خلاصۀTicker اخبار
+Comment[fi]=Uutisnäyttimen yhteenvedon asetukset
+Comment[fr]=Configuration du résumé du téléscripteur de nouvelles
+Comment[fy]=Oersichtsynstellings nijstikker
+Comment[gl]=Configuración do Resumo de Fontes de Novas
+Comment[he]=הגדרות תקציר חדשות רצות
+Comment[hu]=A hírmegjelenítő áttekintőjének beállításai
+Comment[is]=Uppsetning á yfirliti yfir fréttastrimla
+Comment[it]=Impostazioni sommario ticker notizie
+Comment[ja]=ニュースティッカーの設定
+Comment[ka]=სიახლეთა ტიკერის დაიჯესტის კონფიგურაცია
+Comment[kk]=Жаңалық таспасының тұжырымынын баптау
+Comment[km]=រៀបចំ​សេចក្ដី​សង្ខេប​កម្មវិធី​ទទួល​ព័ត៌មាន
+Comment[lt]=News Ticker santraukos nustatymai
+Comment[nb]=Oppsett av sammendraget til nyhetstelegrafen
+Comment[nds]=Narichten-Översicht instellen
+Comment[ne]=न्यूज टिकर सारांश सेटअप
+Comment[nl]=Overzichtsinstellingen nieuwsticker
+Comment[nn]=Oppsett av nyhendetelegrafsamandrag
+Comment[pl]=Ustawienia podsumowania wiadomości
+Comment[pt]=Configuração do Sumário do Extractor de Notícias
+Comment[pt_BR]=Configuração de Resumo de Notícias
+Comment[ru]=Настройка сводки новостей
+Comment[sk]=Nastavenie súhrnu správ
+Comment[sl]=Nastavitve povzetka novic
+Comment[sr]=Подешавање сажетка приказивања вести
+Comment[sr@Latn]=Podešavanje sažetka prikazivanja vesti
+Comment[sv]=Inställning av nyhetsövervakningsöversikt
+Comment[tr]=Haber Yakalayıcı Özet Ayarları
+Comment[uk]=Налаштування зведення стрічки новин
+Comment[zh_CN]=新闻点点通摘要设置
+Comment[zh_TW]=新聞顯示器摘要設定
+Keywords=news ticker, configure, settings
+Keywords[bg]=новини, източник, настройки, news ticker, configure, settings
+Keywords[bs]=news ticker, configure, settings, vijesti, newsticker, podešavanje
+Keywords[ca]=teletip, configura, opcions
+Keywords[cs]=novinky,nastavení
+Keywords[da]=nyhedstelegraf, indstil, opsætning
+Keywords[de]=Newsticker,Einrichten,Einstellungen
+Keywords[el]=προβολέας ειδήσεων, ρύθμιση, ρυθμίσεις
+Keywords[es]=teletipo de noticias, configurar, opciones
+Keywords[et]=uudistejälgija, seadistamine, seadistused
+Keywords[eu]=berri markatzaileak, konfiguratu, ezarpenak
+Keywords[fa]=ticker اخبار، پیکربندی، تنظیمات
+Keywords[fi]=uutiset, asetukset, muokkaa
+Keywords[fr]=configurer,paramètre,news ticker, téléscripteur
+Keywords[fy]=newsticker,instellingen,ynstellings,configuratie,nieuws,nijs
+Keywords[gl]=capturador de novas, configurar, opcións
+Keywords[he]=news ticker, configure, settings, חדשות, תצורה, הגדרות
+Keywords[hu]=hírmegjelenítő,konfigurálás,beállítások
+Keywords[is]=fréttastrimill, stillingar, stilla
+Keywords[it]=ticker notizie, configura, impostazioni
+Keywords[ja]=ニュースティッカー,設定,設定
+Keywords[ka]=სიახლეთა ტიკერი, კონფიგურაცია, პარამეტრები
+Keywords[km]=កម្មវិធី​ទទួល​ព័ត៌មាន,កំណត់​រចនាសម្ព័ន្ធ,ការ​កំណត់
+Keywords[lt]=news ticker, configure, settings, konfigūravimas, nustatymai, naujienų pranešėjas
+Keywords[ms]=Pengetik berita, konfigur, seting
+Keywords[nb]=nyhetstelegraf, oppsett, innstillinger
+Keywords[nds]=Narichten-Ticker, instellen
+Keywords[ne]=न्यूज टिकर, कन्फिगर, सेटिङ
+Keywords[nl]=newsticker,instellingen,configuratie,nieuws
+Keywords[nn]=nyhendetelegraf,oppsett,innstillingar
+Keywords[pl]=news ticker,wiadomości,nagłówki,konfiguracja,ustawienia
+Keywords[pt]=notícias, configurar, configuração
+Keywords[pt_BR]=mostrador de notícias,configurar, preferências
+Keywords[ru]=news ticker, configure, settings, настройка, новости
+Keywords[sk]=zdroje správ,nastavenie
+Keywords[sl]=prikazovalnik novic, nastavi, nastavitve
+Keywords[sr]=news ticker, подеси, поставке
+Keywords[sr@Latn]=news ticker, podesi, postavke
+Keywords[sv]=nyhetsövervakare, anpassa, inställningar
+Keywords[ta]=கேமுகவரிப்புத்தகம்,கட்டமைப்பு,அமைவுகள்
+Keywords[tg]=news ticker, configure, settings, танзимот
+Keywords[tr]=haber izleyici, yapılandırma, yapılandır
+Keywords[uk]=новини, налаштування, параметри
+Keywords[zh_CN]=news ticker, configure, settings, 新闻点点通, 配置, 设置
diff --git a/kontact/plugins/newsticker/kcmkontactknt.h b/kontact/plugins/newsticker/kcmkontactknt.h
new file mode 100644
index 000000000..7463cf004
--- /dev/null
+++ b/kontact/plugins/newsticker/kcmkontactknt.h
@@ -0,0 +1,102 @@
+/*
+ This file is part of Kontact.
+ Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ As a special exception, permission is given to link this program
+ with any edition of Qt, and distribute the resulting executable,
+ without including the source code for Qt in the source distribution.
+*/
+
+#ifndef KCMKONTACTKNT_H
+#define KCMKONTACTKNT_H
+
+#include <kcmodule.h>
+
+class QListViewItem;
+class QSpinxBox;
+
+class KAboutData;
+class KListView;
+class KPushButton;
+
+class NewsItem;
+
+class KCMKontactKNT : public KCModule
+{
+ Q_OBJECT
+
+ public:
+ KCMKontactKNT( QWidget *parent = 0, const char *name = 0 );
+
+ virtual void load();
+ virtual void save();
+ virtual void defaults();
+ virtual const KAboutData* aboutData() const;
+
+ private slots:
+ void addNews();
+ void removeNews();
+ void newFeed();
+ void deleteFeed();
+
+ void selectedChanged( QListViewItem *item );
+ void allCurrentChanged( QListViewItem *item );
+
+ void modified();
+
+ private:
+ void initGUI();
+ void loadNews();
+ void loadCustomNews();
+ void storeCustomNews();
+ void scanNews();
+
+ bool dcopActive() const;
+
+ KListView *mAllNews;
+ KListView *mSelectedNews;
+ QListViewItem *mCustomItem;
+
+ KPushButton *mAddButton;
+ KPushButton *mRemoveButton;
+ KPushButton *mNewButton;
+ KPushButton *mDeleteButton;
+ QSpinBox *mUpdateInterval;
+ QSpinBox *mArticleCount;
+
+ QMap<QString, QString> mFeedMap;
+ QValueList<NewsItem*> mCustomFeeds;
+};
+
+class NewsEditDialog : public KDialogBase
+{
+ Q_OBJECT
+
+ public:
+ NewsEditDialog( const QString&, const QString&, QWidget *parent );
+ QString title() const;
+ QString url() const;
+
+ private slots:
+ void modified();
+
+ private:
+ QLineEdit *mTitle;
+ QLineEdit *mURL;
+};
+
+#endif
diff --git a/kontact/plugins/newsticker/newsfeeds.h b/kontact/plugins/newsticker/newsfeeds.h
new file mode 100644
index 000000000..fb5ef4098
--- /dev/null
+++ b/kontact/plugins/newsticker/newsfeeds.h
@@ -0,0 +1,315 @@
+/*
+ This file is part of Kontact.
+ Copyright (c) 2004 Tobias Koenig <tokoe@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ As a special exception, permission is given to link this program
+ with any edition of Qt, and distribute the resulting executable,
+ without including the source code for Qt in the source distribution.
+*/
+
+#ifndef NEWSFEEDS_H
+#define NEWSFEEDS_H
+
+#include <qvaluelist.h>
+
+#define DEFAULT_NEWSSOURCES 60
+
+class NewsSourceData
+{
+ public:
+ typedef QValueList<NewsSourceData> List;
+
+ enum Category { Arts, Business, Computers, Misc,
+ Recreation, Society };
+
+ NewsSourceData( const QString &name = I18N_NOOP( "Unknown" ),
+ const QString &url = QString::null,
+ const QString &icon = QString::null,
+ const Category category= Computers )
+ : mName( name ), mURL( url ), mIcon( icon ), mCategory( category )
+ {
+ }
+
+ QString name() const { return mName; }
+ QString url() const { return mURL; }
+ QString icon() const { return mIcon; }
+ Category category() const { return mCategory; }
+
+ QString mName;
+ QString mURL;
+ QString mIcon;
+ Category mCategory;
+};
+
+static NewsSourceData NewsSourceDefault[DEFAULT_NEWSSOURCES] = {
+ // Arts ---------------
+ NewsSourceData(
+ QString::fromLatin1("Bureau 42"),
+ QString::fromLatin1("http://www.bureau42.com/rdf/"),
+ QString::fromLatin1("http://www.bureau42.com/favicon.ico"),
+ NewsSourceData::Arts ),
+ NewsSourceData(
+ QString::fromLatin1("eFilmCritic"),
+ QString::fromLatin1("http://efilmcritic.com/fo.rdf"),
+ QString::fromLatin1("http://efilmcritic.com/favicon.ico"),
+ NewsSourceData::Arts ),
+ // Business -----------
+ NewsSourceData(
+ QString::fromLatin1("Internet.com Business"),
+ QString::fromLatin1("http://headlines.internet.com/internetnews/bus-news/news.rss"),
+ QString::null,
+ NewsSourceData::Business ),
+ NewsSourceData(
+ QString::fromLatin1("TradeSims"),
+ QString::fromLatin1("http://www.tradesims.com/AEX.rdf"),
+ QString::null,
+ NewsSourceData::Business ),
+ // Computers ----------
+ NewsSourceData(
+ QString::fromLatin1("KDE Deutschland"),
+ QString::fromLatin1("http://www.kde.de/nachrichten/nachrichten.rdf"),
+ QString::fromLatin1("http://www.kde.de/favicon.ico"),
+ NewsSourceData::Computers ),
+ NewsSourceData(
+ QString::fromLatin1("KDE France"),
+ QString::fromLatin1("http://www.kde-france.org/backend-breves.php3"),
+ QString::null,
+ NewsSourceData::Computers ),
+ NewsSourceData(
+ QString::fromLatin1("FreeBSD Project News"),
+ QString::fromLatin1("http://www.freebsd.org/news/news.rdf"),
+ QString::fromLatin1("http://www.freebsd.org/favicon.ico"),
+ NewsSourceData::Computers ),
+ NewsSourceData(
+ QString::fromLatin1("dot.kde.org"),
+ QString::fromLatin1("http://www.kde.org/dotkdeorg.rdf"),
+ QString::fromLatin1("http://www.kde.org/favicon.ico"),
+ NewsSourceData::Computers ),
+ NewsSourceData( QString::fromLatin1("KDE-Look.org"),
+ QString::fromLatin1("http://www.kde.org/kde-look-content.rdf"),
+ QString::fromLatin1("http://kde-look.org/img/favicon-1-1.ico"),
+ NewsSourceData::Computers ),
+ NewsSourceData( QString::fromLatin1("KDE-Apps.org"),
+ QString::fromLatin1("http://www.kde.org/dot/kde-apps-content.rdf"),
+ QString::fromLatin1("http://kde-apps.org/img/favicon-1-1.ico"),
+ NewsSourceData::Computers ),
+ NewsSourceData( QString::fromLatin1("DesktopLinux"),
+ QString::fromLatin1("http://www.desktoplinux.com/backend/index.html"),
+ QString::fromLatin1("http://www.desktoplinux.com/images/favicon.ico"),
+ NewsSourceData::Computers ),
+ NewsSourceData( QString::fromLatin1("DistroWatch"),
+ QString::fromLatin1("http://distrowatch.com/news/dw.xml"),
+ QString::fromLatin1("http://distrowatch.com/favicon.ico"),
+ NewsSourceData::Computers ),
+ /*URL changed*/
+ NewsSourceData(
+ QString::fromLatin1("GNOME News"),
+ QString::fromLatin1("http://www.gnomedesktop.org/node/feed"),
+ QString::null,
+ NewsSourceData::Computers ),
+ NewsSourceData(
+ QString::fromLatin1("Slashdot"),
+ QString::fromLatin1("http://slashdot.org/slashdot.rdf"),
+ QString::fromLatin1("http://slashdot.org/favicon.ico"),
+ NewsSourceData::Computers ),
+ NewsSourceData(
+ QString::fromLatin1("Ask Slashdot"),
+ QString::fromLatin1("http://slashdot.org/askslashdot.rdf"),
+ QString::fromLatin1("http://slashdot.org/favicon.ico"),
+ NewsSourceData::Computers ),
+ NewsSourceData(
+ QString::fromLatin1("Slashdot: Features"),
+ QString::fromLatin1("http://slashdot.org/features.rdf"),
+ QString::fromLatin1("http://slashdot.org/favicon.ico"),
+ NewsSourceData::Computers ),
+ NewsSourceData(
+ QString::fromLatin1("Slashdot: Apache"),
+ QString::fromLatin1("http://slashdot.org/apache.rdf"),
+ QString::fromLatin1("http://slashdot.org/favicon.ico"),
+ NewsSourceData::Computers ),
+ NewsSourceData(
+ QString::fromLatin1("Slashdot: Books"),
+ QString::fromLatin1("http://slashdot.org/books.rdf"),
+ QString::fromLatin1("http://slashdot.org/favicon.ico"),
+ NewsSourceData::Computers ),
+ NewsSourceData(
+ QString::fromLatin1("Jabber News"),
+ QString::fromLatin1("http://www.jabber.org/news/rss.xml"),
+ QString::null,
+ NewsSourceData::Computers ),
+ NewsSourceData(
+ QString::fromLatin1("Freshmeat"),
+ QString::fromLatin1("http://freshmeat.net/backend/fm.rdf"),
+ QString::fromLatin1("http://freshmeat.net/favicon.ico"),
+ NewsSourceData::Computers ),
+ NewsSourceData(
+ QString::fromLatin1("Linux Weekly News"),
+ QString::fromLatin1("http://www.lwn.net/headlines/rss"),
+ QString::fromLatin1("http://www.lwn.net/favicon.ico"),
+ NewsSourceData::Computers ),
+ NewsSourceData(
+ QString::fromLatin1("heise online news"),
+ QString::fromLatin1("http://www.heise.de/newsticker/heise.rdf"),
+ QString::fromLatin1("http://www.heise.de/favicon.ico"),
+ NewsSourceData::Computers ),
+ NewsSourceData(
+ QString::fromLatin1("RUS-CERT Ticker"),
+ QString::fromLatin1("http://cert.uni-stuttgart.de/ticker/rus-cert.rdf"),
+ QString::fromLatin1("http://cert.uni-stuttgart.de/favicon.ico"),
+ NewsSourceData::Computers ),
+ NewsSourceData(
+ QString::fromLatin1("RUS-CERT Elsewhere"),
+ QString::fromLatin1("http://cert.uni-stuttgart.de/ticker/rus-cert-elsewhere.rdf"),
+ QString::fromLatin1("http://cert.uni-stuttgart.de/favicon.ico"),
+ NewsSourceData::Computers ),
+ NewsSourceData(
+ QString::fromLatin1("Kuro5hin"),
+ QString::fromLatin1("http://kuro5hin.org/backend.rdf"),
+ QString::fromLatin1("http://kuro5hin.org/favicon.ico"),
+ NewsSourceData::Computers ),
+ NewsSourceData(
+ QString::fromLatin1("Prolinux"),
+ QString::fromLatin1("http://www.pl-forum.de/backend/pro-linux.rdf"),
+ QString::fromLatin1("http://www.prolinux.de/favicon.ico"),
+ NewsSourceData::Computers ),
+ NewsSourceData(
+ QString::fromLatin1("LinuxSecurity.com"),
+ QString::fromLatin1("http://www.linuxsecurity.com/linuxsecurity_hybrid.rdf"),
+ QString::fromLatin1("http://www.linuxsecurity.com/favicon.ico"),
+ NewsSourceData::Computers ),
+ NewsSourceData(
+ QString::fromLatin1("Linux Game Tome"),
+ QString::fromLatin1("http://happypenguin.org/html/news.rdf"),
+ QString::null,
+ NewsSourceData::Computers ),
+ NewsSourceData(
+ QString::fromLatin1("Mozilla"),
+ QString::fromLatin1("http://www.mozilla.org/news.rdf"),
+ QString::fromLatin1("http://www.mozillazine.org/favicon.ico"),
+ NewsSourceData::Computers ),
+ NewsSourceData(
+ QString::fromLatin1("MozillaZine"),
+ QString::fromLatin1("http://www.mozillazine.org/contents.rdf"),
+ QString::fromLatin1("http://www.mozillazine.org/favicon.ico"),
+ NewsSourceData::Computers ),
+ NewsSourceData(
+ QString::fromLatin1("Daemon News"),
+ QString::fromLatin1("http://daily.daemonnews.org/ddn.rdf.php3"),
+ QString::null,
+ NewsSourceData::Computers ),
+ NewsSourceData(
+ QString::fromLatin1("use Perl;"),
+ QString::fromLatin1("http://use.perl.org/useperl.rdf"),
+ QString::null,
+ NewsSourceData::Computers ),
+ NewsSourceData(
+ QString::fromLatin1("Root prompt"),
+ QString::fromLatin1("http://www.rootprompt.org/rss/"),
+ QString::fromLatin1("http://www.rootprompt.org/favicon.ico"),
+ NewsSourceData::Computers ),
+ NewsSourceData(
+ QString::fromLatin1("SecurityFocus"),
+ QString::fromLatin1("http://www.securityfocus.com/topnews-rdf.html"),
+ QString::fromLatin1("http://www.securityfocus.com/favicon.ico"),
+ NewsSourceData::Computers ),
+ NewsSourceData(
+ QString::fromLatin1("Arstechnica"),
+ QString::fromLatin1("http://arstechnica.com/etc/rdf/ars.rdf"),
+ QString::fromLatin1("http://arstechnica.com/favicon.ico"),
+ NewsSourceData::Computers ),
+ NewsSourceData(
+ QString::fromLatin1("amiga-news.de - deutschsprachige Amiga Nachrichten"),
+ QString::fromLatin1("http://www.amiga-news.de/de/backends/news/index.rss"),
+ QString::fromLatin1("http://www.amiga-news.de/favicon.ico"),
+ NewsSourceData::Computers ),
+ NewsSourceData(
+ QString::fromLatin1("amiga-news.de - english Amiga news"),
+ QString::fromLatin1("http://www.amiga-news.de/en/backends/news/index.rss"),
+ QString::fromLatin1("http://www.amiga-news.de/favicon.ico"),
+ NewsSourceData::Computers ),
+ NewsSourceData(
+ QString::fromLatin1("FreshPorts - the place for ports"),
+ QString::fromLatin1("http://www.freshports.org/news.php3"),
+ QString::fromLatin1("http://www.freshports.org/favicon.ico"),
+ NewsSourceData::Computers ),
+ NewsSourceData(
+ QString::fromLatin1("zez.org - about code "),
+ QString::fromLatin1("http://zez.org/article/rssheadlines"),
+ QString::null,
+ NewsSourceData::Computers ),
+ NewsSourceData(
+ QString::fromLatin1("BSDatwork.com"),
+ QString::fromLatin1("http://BSDatwork.com/backend.php"),
+ QString::fromLatin1("http://BSDatwork.com/favicon.ico"),
+ NewsSourceData::Computers ),
+ NewsSourceData(
+ QString::fromLatin1("FreshSource - the place for source"),
+ QString::fromLatin1("http://www.freshsource.org/news.php"),
+ QString::fromLatin1("http://www.freshsource.org/favicon.ico"),
+ NewsSourceData::Computers ),
+ NewsSourceData(
+ QString::fromLatin1("The FreeBSD Diary"),
+ QString::fromLatin1("http://www.freebsddiary.org/news.php"),
+ QString::fromLatin1("http://www.freebsddiary.org/favicon.ico"),
+ NewsSourceData::Computers ),
+ // Miscellaneous ------
+ NewsSourceData(
+ QString::fromLatin1("tagesschau.de"),
+ QString::fromLatin1("http://www.tagesschau.de/newsticker.rdf"),
+ QString::fromLatin1("http://www.tagesschau.de/favicon.ico"),
+ NewsSourceData::Misc ),
+ NewsSourceData(
+ QString::fromLatin1("CNN Top Stories"),
+ QString::fromLatin1("http://rss.cnn.com/rss/cnn_topstories.rss"),
+ QString::fromLatin1("http://www.cnn.com/favicon.ico"),
+ NewsSourceData::Misc ),
+ /*feed URL changed*/
+ NewsSourceData(
+ QString::fromLatin1("HotWired"),
+ QString::fromLatin1("http://www.wired.com/news/feeds/rss2/0,2610,,00.xml"),
+ QString::fromLatin1("http://www.hotwired.com/favicon.ico"),
+ NewsSourceData::Misc ),
+ NewsSourceData(
+ QString::fromLatin1("The Register"),
+ QString::fromLatin1("http://www.theregister.co.uk/headlines.rss"),
+ QString::fromLatin1("http://www.theregister.co.uk/favicon.ico"),
+ NewsSourceData::Misc ),
+ NewsSourceData(
+ QString::fromLatin1( "Christian Science Monitor" ),
+ QString::fromLatin1( "http://www.csmonitor.com/rss/csm.rss"),
+ QString::fromLatin1( "http://www.csmonitor.com/favicon.ico"),
+ NewsSourceData::Misc ),
+ // Recreation
+ // Society
+ NewsSourceData(
+ QString::fromLatin1("nippon.it"),
+ QString::fromLatin1("http://www.nippon.it/backend.it.php"),
+ QString::fromLatin1("http://www.nippon.it/favicon.ico"),
+ NewsSourceData::Society ),
+ NewsSourceData(
+ QString::fromLatin1( "gflash" ),
+ QString::fromLatin1( "http://www.gflash.de/backend.php"),
+ QString::fromLatin1( "http://www.gflash.de/favicon.ico"),
+ NewsSourceData::Society ),
+ NewsSourceData(
+ QString::fromLatin1( "Quintessenz" ),
+ QString::fromLatin1( "http://quintessenz.at/cgi-bin/rdf"),
+ QString::fromLatin1( "http://quintessenz.at/favicon.ico"),
+ NewsSourceData::Society )
+};
+
+#endif
diff --git a/kontact/plugins/newsticker/newsticker_plugin.cpp b/kontact/plugins/newsticker/newsticker_plugin.cpp
new file mode 100644
index 000000000..0bc42bd14
--- /dev/null
+++ b/kontact/plugins/newsticker/newsticker_plugin.cpp
@@ -0,0 +1,43 @@
+/*
+ This file is part of Kontact.
+ Copyright (C) 2003 Tobias Koenig <tokoe@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include <kgenericfactory.h>
+#include <klocale.h>
+#include <kparts/componentfactory.h>
+#include "core.h"
+
+#include "summarywidget.h"
+
+#include "newsticker_plugin.h"
+
+typedef KGenericFactory< NewsTickerPlugin, Kontact::Core > NewsTickerPluginFactory;
+K_EXPORT_COMPONENT_FACTORY( libkontact_newstickerplugin,
+ NewsTickerPluginFactory( "kontact_newstickerplugin" ) )
+
+NewsTickerPlugin::NewsTickerPlugin( Kontact::Core *core, const char *name, const QStringList& )
+ : Kontact::Plugin( core, core, name )
+{
+ setInstance( NewsTickerPluginFactory::instance() );
+}
+
+Kontact::Summary *NewsTickerPlugin::createSummaryWidget( QWidget* parentWidget )
+{
+ return new SummaryWidget( parentWidget );
+}
diff --git a/kontact/plugins/newsticker/newsticker_plugin.h b/kontact/plugins/newsticker/newsticker_plugin.h
new file mode 100644
index 000000000..d912da797
--- /dev/null
+++ b/kontact/plugins/newsticker/newsticker_plugin.h
@@ -0,0 +1,40 @@
+/*
+ This file is part of Kontact.
+ Copyright (C) 2003 Tobias Koenig <tokoe@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef NEWSTICKER_PLUGIN_H
+#define NEWSTICKER_PLUGIN_H
+
+#include "plugin.h"
+
+class SummaryWidget;
+
+class NewsTickerPlugin : public Kontact::Plugin
+{
+ public:
+ NewsTickerPlugin( Kontact::Core *core, const char *name, const QStringList& );
+ NewsTickerPlugin();
+
+ virtual Kontact::Summary *createSummaryWidget( QWidget* parentWidget );
+
+ protected:
+ virtual KParts::ReadOnlyPart* createPart() { return 0L; }
+};
+
+#endif
diff --git a/kontact/plugins/newsticker/newstickerplugin.desktop b/kontact/plugins/newsticker/newstickerplugin.desktop
new file mode 100644
index 000000000..18a34cda9
--- /dev/null
+++ b/kontact/plugins/newsticker/newstickerplugin.desktop
@@ -0,0 +1,99 @@
+[Desktop Entry]
+Type=Service
+Icon=knewsticker
+ServiceTypes=Kontact/Plugin,KPluginInfo
+TryExec=rssservice
+
+X-KDE-Library=libkontact_newstickerplugin
+X-KDE-KontactPluginVersion=6
+X-KDE-KontactPluginHasSummary=true
+X-KDE-KontactPluginHasPart=false
+
+X-KDE-PluginInfo-Name=kontact_newstickerplugin
+X-KDE-PluginInfo-Version=0.1
+X-KDE-PluginInfo-License=LGPL
+X-KDE-PluginInfo-EnabledByDefault=true
+
+Comment=Newsticker Component
+Comment[bg]=Компонент за новини
+Comment[ca]=Component de teletip de notícies
+Comment[da]=Nyhedstelegraf-komponent
+Comment[de]=Newsticker-Komponente
+Comment[el]=Συστατικό προβολέα ειδήσεων
+Comment[es]=Componente de teletipo de noticias
+Comment[et]=Uudistejälgija plugin
+Comment[fr]=Composant Newsticker
+Comment[is]=Fréttastrimilseining
+Comment[it]=Componente ticker notizie
+Comment[ja]=ニュースティッカーコンポーネント
+Comment[km]=សមាសភាគ Newsticker
+Comment[nds]=Narichtentelegraaf-Komponent
+Comment[nl]=Nieuwstickercomponent
+Comment[pl]=Składnik paska wiadomości
+Comment[ru]=Компонент новостей
+Comment[sr]=Компонента откуцавача вести
+Comment[sr@Latn]=Komponenta otkucavača vesti
+Comment[sv]=Nyhetsövervakningskomponent
+Comment[tr]=Haber İzleyici Bileşeni
+Comment[zh_CN]=新闻点点通组件
+Comment[zh_TW]=新聞顯示組件
+Name=News
+Name[af]=Nuus
+Name[ar]=الأخبار
+Name[be]=Навіны
+Name[bg]=Новини
+Name[br]=Keleier
+Name[bs]=Usenet
+Name[ca]=Notícies
+Name[cs]=Novinky
+Name[cy]=Newyddion
+Name[da]=Nyheder
+Name[de]=Usenet
+Name[el]=Νέα
+Name[eo]=Novaĵoj
+Name[es]=Noticias
+Name[et]=Uudisegrupid
+Name[eu]=Berriak
+Name[fa]=اخبار
+Name[fi]=Uutiset
+Name[fr]=Nouvelles
+Name[fy]=Nijs
+Name[ga]=Nuacht
+Name[gl]=Novas
+Name[he]=חדשות
+Name[hi]=समाचार
+Name[hu]=Hírek
+Name[is]=Fréttir
+Name[ja]=ニュース
+Name[ka]=სიახლეები
+Name[kk]=Жаңалықтар
+Name[km]=ព័ត៌មាន
+Name[lt]=Naujienos
+Name[mk]=Вести
+Name[ms]=Berita
+Name[nb]=Njus
+Name[nds]=Narichten
+Name[ne]=समाचार
+Name[nl]=Nieuws
+Name[nn]=Nyheiter
+Name[pa]=ਖ਼ਬਰਾਂ
+Name[pl]=Listy dyskusyjne
+Name[pt]=Notícias
+Name[pt_BR]=Notícias
+Name[ro]=Ştiri
+Name[ru]=Новости
+Name[se]=Ođđasat
+Name[sk]=Diskusné skupiny
+Name[sl]=Novice
+Name[sr]=Вести
+Name[sr@Latn]=Vesti
+Name[sv]=Nyheter
+Name[ta]=செய்திகள்
+Name[tg]=Ахборот
+Name[th]=ข่าว
+Name[tr]=Haberler
+Name[uk]=Новини
+Name[uz]=Yangiliklar
+Name[uz@cyrillic]=Янгиликлар
+Name[zh_CN]=新闻
+Name[zh_TW]=新聞
diff --git a/kontact/plugins/newsticker/summarywidget.cpp b/kontact/plugins/newsticker/summarywidget.cpp
new file mode 100644
index 000000000..14b7bc27a
--- /dev/null
+++ b/kontact/plugins/newsticker/summarywidget.cpp
@@ -0,0 +1,319 @@
+/*
+ This file is part of Kontact.
+ Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ As a special exception, permission is given to link this program
+ with any edition of Qt, and distribute the resulting executable,
+ without including the source code for Qt in the source distribution.
+*/
+
+#include <qclipboard.h>
+#include <qeventloop.h>
+#include <qhbox.h>
+#include <qlayout.h>
+#include <qpixmap.h>
+#include <qpopupmenu.h>
+#include <qcursor.h>
+
+#include <dcopclient.h>
+#include <kapplication.h>
+#include <kcharsets.h>
+#include <kconfig.h>
+#include <kdebug.h>
+#include <kglobal.h>
+#include <kiconloader.h>
+#include <klocale.h>
+#include <kurllabel.h>
+
+#include "summarywidget.h"
+
+SummaryWidget::SummaryWidget( QWidget *parent, const char *name )
+ : Kontact::Summary( parent, name ),
+ DCOPObject( "NewsTickerPlugin" ), mLayout( 0 ), mFeedCounter( 0 )
+{
+ QVBoxLayout *vlay = new QVBoxLayout( this, 3, 3 );
+
+ QPixmap icon = KGlobal::iconLoader()->loadIcon( "kontact_news",
+ KIcon::Desktop, KIcon::SizeMedium );
+
+ QWidget *header = createHeader( this, icon, i18n( "News Feeds" ) );
+ vlay->addWidget( header );
+
+ QString error;
+ QCString appID;
+
+ bool dcopAvailable = true;
+ if ( !kapp->dcopClient()->isApplicationRegistered( "rssservice" ) ) {
+ if ( KApplication::startServiceByDesktopName( "rssservice", QStringList(), &error, &appID ) ) {
+ QLabel *label = new QLabel( i18n( "No rss dcop service available.\nYou need rssservice to use this plugin." ), this );
+ vlay->addWidget( label, Qt::AlignHCenter );
+ dcopAvailable = false;
+ }
+ }
+
+ mBaseWidget = new QWidget( this, "baseWidget" );
+ vlay->addWidget( mBaseWidget );
+
+ connect( &mTimer, SIGNAL( timeout() ), this, SLOT( updateDocuments() ) );
+
+ readConfig();
+
+ connectDCOPSignal( 0, 0, "documentUpdateError(DCOPRef,int)", "documentUpdateError(DCOPRef, int)", false );
+
+ if ( dcopAvailable )
+ initDocuments();
+
+ connectDCOPSignal( 0, 0, "added(QString)", "documentAdded(QString)", false );
+ connectDCOPSignal( 0, 0, "removed(QString)", "documentRemoved(QString)", false );
+}
+
+int SummaryWidget::summaryHeight() const
+{
+ return ( mFeeds.count() == 0 ? 1 : mFeeds.count() );
+}
+
+void SummaryWidget::documentAdded( QString )
+{
+ initDocuments();
+}
+
+void SummaryWidget::documentRemoved( QString )
+{
+ initDocuments();
+}
+
+void SummaryWidget::configChanged()
+{
+ readConfig();
+
+ updateView();
+}
+
+void SummaryWidget::readConfig()
+{
+ KConfig config( "kcmkontactkntrc" );
+ config.setGroup( "General" );
+
+ mUpdateInterval = config.readNumEntry( "UpdateInterval", 600 );
+ mArticleCount = config.readNumEntry( "ArticleCount", 4 );
+}
+
+void SummaryWidget::initDocuments()
+{
+ mFeeds.clear();
+
+ DCOPRef dcopCall( "rssservice", "RSSService" );
+ QStringList urls;
+ dcopCall.call( "list()" ).get( urls );
+
+ if ( urls.isEmpty() ) { // add default
+ urls.append( "http://www.kde.org/dotkdeorg.rdf" );
+ dcopCall.send( "add(QString)", urls[ 0 ] );
+ }
+
+ QStringList::Iterator it;
+ for ( it = urls.begin(); it != urls.end(); ++it ) {
+ DCOPRef feedRef = dcopCall.call( "document(QString)", *it );
+
+ Feed feed;
+ feed.ref = feedRef;
+ feedRef.call( "title()" ).get( feed.title );
+ feedRef.call( "link()" ).get( feed.url );
+ feedRef.call( "pixmap()" ).get( feed.logo );
+ mFeeds.append( feed );
+
+ disconnectDCOPSignal( "rssservice", feedRef.obj(), "documentUpdated(DCOPRef)", 0 );
+ connectDCOPSignal( "rssservice", feedRef.obj(), "documentUpdated(DCOPRef)",
+ "documentUpdated(DCOPRef)", false );
+
+ if ( qApp )
+ qApp->eventLoop()->processEvents( QEventLoop::ExcludeUserInput |
+ QEventLoop::ExcludeSocketNotifiers );
+ }
+
+ updateDocuments();
+}
+
+void SummaryWidget::updateDocuments()
+{
+ mTimer.stop();
+
+ FeedList::Iterator it;
+ for ( it = mFeeds.begin(); it != mFeeds.end(); ++it )
+ (*it).ref.send( "refresh()" );
+
+ mTimer.start( 1000 * mUpdateInterval );
+}
+
+void SummaryWidget::documentUpdated( DCOPRef feedRef )
+{
+ ArticleMap map;
+
+ int numArticles = feedRef.call( "count()" );
+ for ( int i = 0; i < numArticles; ++i ) {
+ DCOPRef artRef = feedRef.call( "article(int)", i );
+ QString title, url;
+
+ if ( qApp )
+ qApp->eventLoop()->processEvents( QEventLoop::ExcludeUserInput |
+ QEventLoop::ExcludeSocketNotifiers );
+
+ artRef.call( "title()" ).get( title );
+ artRef.call( "link()" ).get( url );
+
+ QPair<QString, KURL> article(title, KURL( url ));
+ map.append( article );
+ }
+
+ FeedList::Iterator it;
+ for ( it = mFeeds.begin(); it != mFeeds.end(); ++it )
+ if ( (*it).ref.obj() == feedRef.obj() ) {
+ (*it).map = map;
+ if ( (*it).title.isEmpty() )
+ feedRef.call( "title()" ).get( (*it).title );
+ if ( (*it).url.isEmpty() )
+ feedRef.call( "link()" ).get( (*it).url );
+ if ( (*it).logo.isNull() )
+ feedRef.call( "pixmap()" ).get( (*it).logo );
+ }
+
+ mFeedCounter++;
+ if ( mFeedCounter == mFeeds.count() ) {
+ mFeedCounter = 0;
+ updateView();
+ }
+}
+
+void SummaryWidget::updateView()
+{
+ mLabels.setAutoDelete( true );
+ mLabels.clear();
+ mLabels.setAutoDelete( false );
+
+ delete mLayout;
+ mLayout = new QVBoxLayout( mBaseWidget, 3 );
+
+ QFont boldFont;
+ boldFont.setBold( true );
+ boldFont.setPointSize( boldFont.pointSize() + 2 );
+
+ FeedList::Iterator it;
+ for ( it = mFeeds.begin(); it != mFeeds.end(); ++it ) {
+ QHBox *hbox = new QHBox( mBaseWidget );
+ mLayout->addWidget( hbox );
+
+ // icon
+ KURLLabel *urlLabel = new KURLLabel( hbox );
+ urlLabel->setURL( (*it).url );
+ urlLabel->setPixmap( (*it).logo );
+ urlLabel->setMaximumSize( urlLabel->minimumSizeHint() );
+ mLabels.append( urlLabel );
+
+ connect( urlLabel, SIGNAL( leftClickedURL( const QString& ) ),
+ kapp, SLOT( invokeBrowser( const QString& ) ) );
+ connect( urlLabel, SIGNAL( rightClickedURL( const QString& ) ),
+ this, SLOT( rmbMenu( const QString& ) ) );
+
+ // header
+ QLabel *label = new QLabel( hbox );
+ label->setText( KCharsets::resolveEntities( (*it).title ) );
+ label->setAlignment( AlignLeft|AlignVCenter );
+ label->setFont( boldFont );
+ label->setIndent( 6 );
+ label->setMaximumSize( label->minimumSizeHint() );
+ mLabels.append( label );
+
+ hbox->setMaximumWidth( hbox->minimumSizeHint().width() );
+ hbox->show();
+
+ // articles
+ ArticleMap articles = (*it).map;
+ ArticleMap::Iterator artIt;
+ int numArticles = 0;
+ for ( artIt = articles.begin(); artIt != articles.end() && numArticles < mArticleCount; ++artIt ) {
+ urlLabel = new KURLLabel( (*artIt).second.url(), (*artIt).first, mBaseWidget );
+ urlLabel->installEventFilter( this );
+ //TODO: RichText causes too much horizontal space between articles
+ //urlLabel->setTextFormat( RichText );
+ mLabels.append( urlLabel );
+ mLayout->addWidget( urlLabel );
+
+ connect( urlLabel, SIGNAL( leftClickedURL( const QString& ) ),
+ kapp, SLOT( invokeBrowser( const QString& ) ) );
+ connect( urlLabel, SIGNAL( rightClickedURL( const QString& ) ),
+ this, SLOT( rmbMenu( const QString& ) ) );
+
+
+ numArticles++;
+ }
+ }
+
+ for ( QLabel *label = mLabels.first(); label; label = mLabels.next() )
+ label->show();
+}
+
+void SummaryWidget::documentUpdateError( DCOPRef feedRef, int errorCode )
+{
+ kdDebug() << " error while updating document, error code: " << errorCode << endl;
+ FeedList::Iterator it;
+ for ( it = mFeeds.begin(); it != mFeeds.end(); ++it ) {
+ if ( (*it).ref.obj() == feedRef.obj() ) {
+ mFeeds.remove( it );
+ break;
+ }
+ }
+
+ if ( mFeedCounter == mFeeds.count() ) {
+ mFeedCounter = 0;
+ updateView();
+ }
+
+}
+
+QStringList SummaryWidget::configModules() const
+{
+ return "kcmkontactknt.desktop";
+}
+
+void SummaryWidget::updateSummary( bool )
+{
+ updateDocuments();
+}
+
+void SummaryWidget::rmbMenu( const QString& url )
+{
+ QPopupMenu menu;
+ menu.insertItem( i18n( "Copy URL to Clipboard" ) );
+ int id = menu.exec( QCursor::pos() );
+ if ( id != -1 )
+ kapp->clipboard()->setText( url, QClipboard::Clipboard );
+}
+
+bool SummaryWidget::eventFilter( QObject *obj, QEvent* e )
+{
+ if ( obj->inherits( "KURLLabel" ) ) {
+ KURLLabel* label = static_cast<KURLLabel*>( obj );
+ if ( e->type() == QEvent::Enter )
+ emit message( label->url() );
+ if ( e->type() == QEvent::Leave )
+ emit message( QString::null );
+ }
+
+ return Kontact::Summary::eventFilter( obj, e );
+}
+
+#include "summarywidget.moc"
diff --git a/kontact/plugins/newsticker/summarywidget.h b/kontact/plugins/newsticker/summarywidget.h
new file mode 100644
index 000000000..ad914334b
--- /dev/null
+++ b/kontact/plugins/newsticker/summarywidget.h
@@ -0,0 +1,115 @@
+/*
+ This file is part of Kontact.
+ Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ As a special exception, permission is given to link this program
+ with any edition of Qt, and distribute the resulting executable,
+ without including the source code for Qt in the source distribution.
+*/
+
+#ifndef SUMMARYWIDGET_H
+#define SUMMARYWIDGET_H
+
+#include <dcopobject.h>
+#include <dcopref.h>
+
+#include <qmap.h>
+#include <qptrlist.h>
+#include <qtimer.h>
+#include <qwidget.h>
+
+#include "summary.h"
+#include <kurl.h>
+
+class QVBoxLayout;
+class QLabel;
+
+class DCOPRef;
+class KURLLabel;
+
+typedef QValueList< QPair<QString, KURL> > ArticleMap;
+
+typedef struct {
+ DCOPRef ref;
+ QString title;
+ QString url;
+ QPixmap logo;
+ ArticleMap map;
+} Feed;
+
+typedef QValueList<Feed> FeedList;
+
+class SummaryWidget : public Kontact::Summary, public DCOPObject
+{
+ Q_OBJECT
+ K_DCOP
+
+ public:
+ SummaryWidget( QWidget *parent, const char *name = 0 );
+
+ int summaryHeight() const;
+ QStringList configModules() const;
+
+ k_dcop:
+ /**
+ * Inform the newsticker summary widget that an RSSDocument has been updated.
+ */
+ void documentUpdated( DCOPRef );
+ /**
+ * Inform the newsticker summary widget that a feed has been added.
+ */
+ void documentAdded( QString );
+ /**
+ * Inform the newsticker summary widget that a feed has been removed.
+ */
+ void documentRemoved( QString );
+ /**
+ * Inform the newsticker summary widget that an error occurred while updating a feed.
+ * @param ref DCOPRef to the failing RSSDocument.
+ * @param errorCode indicates the cause of the failure: 1 = RSS Parse Error, 2 = Could not access file, 3 = Unknown error.
+ */
+ void documentUpdateError( DCOPRef ref, int errorCode );
+
+ public slots:
+ void updateSummary( bool force = false );
+ void configChanged();
+
+ protected slots:
+ void updateDocuments();
+ void rmbMenu( const QString& );
+
+ protected:
+ virtual bool eventFilter( QObject *obj, QEvent *e );
+ void initDocuments();
+ void updateView();
+ void readConfig();
+
+ private:
+ QVBoxLayout *mLayout;
+ QWidget* mBaseWidget;
+
+ QPtrList<QLabel> mLabels;
+
+ FeedList mFeeds;
+
+ QTimer mTimer;
+ int mUpdateInterval;
+ int mArticleCount;
+ uint mFeedCounter;
+};
+
+#endif