diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | bcb704366cb5e333a626c18c308c7e0448a8e69f (patch) | |
tree | f0d6ab7d78ecdd9207cf46536376b44b91a1ca71 /knewsticker/kntsrcfilepropsdlg | |
download | tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.tar.gz tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.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/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'knewsticker/kntsrcfilepropsdlg')
-rw-r--r-- | knewsticker/kntsrcfilepropsdlg/Makefile.am | 12 | ||||
-rw-r--r-- | knewsticker/kntsrcfilepropsdlg/kntsrcfilepropsdlg.cpp | 130 | ||||
-rw-r--r-- | knewsticker/kntsrcfilepropsdlg/kntsrcfilepropsdlg.desktop | 69 | ||||
-rw-r--r-- | knewsticker/kntsrcfilepropsdlg/kntsrcfilepropsdlg.h | 57 | ||||
-rw-r--r-- | knewsticker/kntsrcfilepropsdlg/kntsrcfilepropsdlgwidget.ui | 215 |
5 files changed, 483 insertions, 0 deletions
diff --git a/knewsticker/kntsrcfilepropsdlg/Makefile.am b/knewsticker/kntsrcfilepropsdlg/Makefile.am new file mode 100644 index 00000000..9782b90c --- /dev/null +++ b/knewsticker/kntsrcfilepropsdlg/Makefile.am @@ -0,0 +1,12 @@ +INCLUDES = -I$(top_srcdir)/knewsticker/common -I$(top_srcdir)/librss $(all_includes) + +kde_module_LTLIBRARIES = libkntsrcfilepropsdlg.la + +libkntsrcfilepropsdlg_la_SOURCES = kntsrcfilepropsdlg.cpp \ + kntsrcfilepropsdlgwidget.ui +libkntsrcfilepropsdlg_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) +libkntsrcfilepropsdlg_la_LIBADD = $(LIB_KIO) ../common/libknewstickercommon.la ../../librss/librss.la +libkntsrcfilepropsdlg_la_METASOURCES = AUTO + +service_DATA = kntsrcfilepropsdlg.desktop +servicedir = $(kde_servicesdir) diff --git a/knewsticker/kntsrcfilepropsdlg/kntsrcfilepropsdlg.cpp b/knewsticker/kntsrcfilepropsdlg/kntsrcfilepropsdlg.cpp new file mode 100644 index 00000000..93bc71cc --- /dev/null +++ b/knewsticker/kntsrcfilepropsdlg/kntsrcfilepropsdlg.cpp @@ -0,0 +1,130 @@ +/* + * kntsrcfilepropsdlg.cpp + * + * Copyright (c) 2001, 2002, 2003 Frerich Raabe <raabe@kde.org> + * + * 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. For licensing and distribution details, check the + * accompanying file 'COPYING'. + */ +#include "kntsrcfilepropsdlg.h" +#include "kntsrcfilepropsdlgwidget.h" +#include "xmlnewsaccess.h" +#include "newsiconmgr.h" + +#include <article.h> +#include <document.h> +#include <loader.h> + +#include <kapplication.h> +#include <klistbox.h> +#include <klocale.h> +#include <kurl.h> +#include <kurllabel.h> +#include <kstandarddirs.h> +#include <kglobal.h> + +#include <qmultilineedit.h> +#include <qvbox.h> + +using namespace RSS; + +class ArticleListBoxItem : public QListBoxText +{ + public: + ArticleListBoxItem( QListBox *listbox, const Article &article ); + + const Article &article() const { return m_article; } + + private: + Article m_article; +}; + +ArticleListBoxItem::ArticleListBoxItem( QListBox *listbox, const Article &article ) + : QListBoxText( listbox ), + m_article( article ) +{ + setText( article.title() ); +} + +KntSrcFilePropsDlg::KntSrcFilePropsDlg(KPropertiesDialog *props) + : KPropsDlgPlugin(props) +{ + m_child = new KntSrcFilePropsDlgWidget(properties->addVBoxPage(i18n("News Resource"))); + connect(m_child->urlName, SIGNAL(leftClickedURL(const QString &)), + SLOT(slotOpenURL(const QString &))); + connect(m_child->lbArticles, SIGNAL(executed(QListBoxItem *)), + SLOT(slotClickedArticle(QListBoxItem *))); + + Loader *loader = Loader::create(); + connect(loader, SIGNAL(loadingComplete(Loader *, Document, Status)), + SLOT(slotConstructUI(Loader *, Document, Status))); + loader->loadFrom(props->item()->url(), new FileRetriever); + + connect(NewsIconMgr::self(), SIGNAL(gotIcon(const KURL &, const QPixmap &)), + SLOT(slotGotIcon(const KURL &, const QPixmap &))); + + m_child->show(); +} + +void KntSrcFilePropsDlg::slotConstructUI(Loader *, Document doc, Status status) +{ + if (status != RSS::Success) + return; + + KURL iconURL = doc.link(); + iconURL.setEncodedPathAndQuery(QString::fromLatin1("/favicon.ico")); + NewsIconMgr::self()->getIcon(iconURL); + + m_child->urlName->setText(doc.title()); + m_child->urlName->setURL(doc.link().url()); + + m_child->mleDescription->setText(doc.description()); + + Article::List::ConstIterator it = doc.articles().begin(); + Article::List::ConstIterator end = doc.articles().end(); + for (; it != end; ++it) + new ArticleListBoxItem(m_child->lbArticles, *it); +} + +void KntSrcFilePropsDlg::slotOpenURL(const QString &url) +{ + kapp->invokeBrowser(url); +} + +void KntSrcFilePropsDlg::slotGotIcon(const KURL &, const QPixmap &pixmap) +{ + m_child->pixmapIcon->setPixmap(pixmap); +} + +void KntSrcFilePropsDlg::slotClickedArticle(QListBoxItem *item) +{ + ArticleListBoxItem *articleItem = static_cast<ArticleListBoxItem *>(item); + slotOpenURL(articleItem->article().link().url()); +} + +QObject *KntSrcFilePropsFactory::createObject(QObject *parent, const char *, + const char *classname, const QStringList &) +{ + if (QString::fromLatin1(classname) == "KPropsDlgPlugin") + { + if (!parent->inherits("KPropertiesDialog")) + return 0L; + + QObject *obj = new KntSrcFilePropsDlg(static_cast<KPropertiesDialog *>(parent)); + return obj; + } + return 0L; +} + +extern "C" +{ + KDE_EXPORT void *init_libkntsrcfilepropsdlg() + { + KGlobal::locale()->insertCatalogue( "knewsticker" ); + return new KntSrcFilePropsFactory(); + } +} + +#include "kntsrcfilepropsdlg.moc" diff --git a/knewsticker/kntsrcfilepropsdlg/kntsrcfilepropsdlg.desktop b/knewsticker/kntsrcfilepropsdlg/kntsrcfilepropsdlg.desktop new file mode 100644 index 00000000..6902d9b3 --- /dev/null +++ b/knewsticker/kntsrcfilepropsdlg/kntsrcfilepropsdlg.desktop @@ -0,0 +1,69 @@ +[Desktop Entry] +Type=Service +Name=KNewsticker Source File Properties Page +Name[af]=K-nuustikker Bron Lêer Eienskappe Bladsy +Name[ar]=صفحة خصائص ملف مصدر مجدد الأخبار +Name[az]=KNewsticker Mənbə Faylı Xüsusiyyətləri Səhifəsi +Name[bg]=Настройване на файла източник на KNewsticker +Name[bn]=কে-নিউজ-টিকার উত্স ফাইল বৈশিষ্ট্যাবলী পাতা +Name[bs]=KNewsticker stranica sa osobinama izvorne datoteke +Name[ca]=Pàgina de propietats dels fitxers font del KNewsticker +Name[cs]=Popis vlastností zdrojového souboru programu KNewsticker +Name[cy]=Tudalen Priodweddau Ffeil Tarddiad KTicerNewyddion +Name[da]=KNewsTickers side med egenskaber for kildefil +Name[de]=KNewsticker: Einstellungsseite für Quelldateien +Name[el]=Σελίδα ιδιοτήτων αρχείου πηγής KNewsticker +Name[eo]=Ecopaĝo por Novaĵprezentilaj fontdosieroj +Name[es]=Página de propiedades de archivos fuente de KNewsticker +Name[et]=KNewstickeri lähtefaili omaduste dialoog +Name[eu]=KNewsticker iturburu fitxategiaren propietateen orria +Name[fa]=صفحۀ ویژگیهای پروندۀ مبدأ KNewsticker +Name[fi]=KNewsticker lähdetiedostojen asetussivu +Name[fr]=Page des propriétés du fichier source de KNewsTicker +Name[gl]=Páxina de propiedades dos arquivos fonte de KNewsTicker +Name[he]=דף מאפייני קובץ מקור של KNewsTicker +Name[hi]=के-न्यूज टिकर स्रोत फ़ाइल गुण पृष्ठ +Name[hr]=Stranica sa postavkama KNewsTicker izvorne datoteke +Name[hu]=A KNewsTicker forrásfájlok tulajdonságlapja +Name[is]=Stillisíða fyrir frumskrár Fréttastrimils +Name[it]=Pagina proprietà file sorgente di notizie per KNewsticker +Name[ja]=KNewsticker ソースファイルプロパティページ +Name[ka]=KNewsticker წყაროს ფაილის თვისებათა გვერდი +Name[kk]=KNewsticker файлының қасиеттер беті +Name[km]=ទំព័រលក្ខណៈសម្បត្តិឯកសារប្រភព KNewsticker +Name[lt]=KNewsticker pirminio teksto bylos parinkčių puslapis +Name[lv]=KZiņutikkera Avota Faila Īpašību Lapa +Name[mk]=Страница за својствата на изворната датотека на KNewsticker +Name[mn]=KNewsticker сурвалж файлын Тодорхойлолт хуудас +Name[ms]=Laman Ciri-ciri Fail Sumber KNewsticker +Name[mt]=Paġna ta' Propjetajiet Fajl ta' Sors KNewsticker +Name[nb]=Egenskaper for kildefiler til KNewsticker +Name[nds]=KNewsTicker Borndateien-Egenschappensiet +Name[ne]=केडीई न्यूज टिकर स्रोत फाइल विशेषता पृष्ठ +Name[nl]=KNewsticker Bronbestand Eigenschappenpagina +Name[nn]=Eigenskapsside for KNewsticker-kjeldefil +Name[nso]=Letlakala la Dithoto tsa Faele ya Mothopo wa seswai sa KDitaba +Name[pl]=Strona właściwości pliku źródłowego KNewsTickera +Name[pt]=Página de Propriedades do Ficheiro da Fonte do KNewsticker +Name[pt_BR]=Página de Propriedades do Arquivo Fonte do KNewsTicher +Name[ro]=Pagină de proprietăţi pentru fişier sursă KNewsticker +Name[ru]=Страница свойств сведений о файле KNewsticker +Name[se]=KNewsTicker-gáldofiilla iešvuohtasiidu +Name[sk]=Popis vlastností konfiguračného súboru pre KNewsticker +Name[sl]=Stran z lastnostmi za izvorno datoteko KNewsTicker +Name[sr]=KNewsticker страна за подешавање својстава изворних фајлова +Name[sr@Latn]=KNewsticker strana za podešavanje svojstava izvornih fajlova +Name[sv]=Nyhetsövervakarens sida för källfilsegenskaper +Name[ta]=கேசெய்தி அறிவிப்பானின் மூல கோப்பின் பண்புகளை அறியும் பக்கம். +Name[tg]=Саҳофаи Хусусиятҳои Файли Сарчашмавии KДидабони Ахборот +Name[th]=หน้าคุณสมบัติของแฟ้มต้นฉบับตั๋วข่าว - K +Name[tr]=KDE Haber Gözlemcisi Kaynak Dosyası Özellikler Sayfası +Name[uk]=Сторінка властивостей вихідного файла KNewsticker +Name[ven]=Siatari la tshishumiswa tshavhubvo ha faela la tshauthika mafhungo a K +Name[xh]=Iphepha Leempahla Lemvelaphi Yefayile ye KNewsticker +Name[zh_CN]=KNewsticker 来源文件属性页 +Name[zh_HK]=KNewsticker 來源檔案屬性頁 +Name[zh_TW]=KNewsticker 來源檔案屬性頁 +Name[zu]=Umlekeleli wezindaba ze K wephepha lefayela Yemvelaphi Yempahla +X-KDE-Library=libkntsrcfilepropsdlg +ServiceTypes=KPropsDlg/Plugin,text/rdf,text/rss diff --git a/knewsticker/kntsrcfilepropsdlg/kntsrcfilepropsdlg.h b/knewsticker/kntsrcfilepropsdlg/kntsrcfilepropsdlg.h new file mode 100644 index 00000000..8fe1be58 --- /dev/null +++ b/knewsticker/kntsrcfilepropsdlg/kntsrcfilepropsdlg.h @@ -0,0 +1,57 @@ +/* + * kntsrcfilepropsdlg.h + * + * Copyright (c) 2001 Frerich Raabe <raabe@kde.org> + * + * 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. For licensing and distribution details, check the + * accompanying file 'COPYING'. + */ +#ifndef KNTSRCFILEPROPSDLG_H +#define KNTSRCFILEPROPSDLG_H + +#include <global.h> + +#include <klibloader.h> +#include <kpropertiesdialog.h> + +class KntSrcFilePropsDlgWidget; +class QListBoxItem; + +namespace RSS { + class Loader; + class Document; +} + +using RSS::Loader; +using RSS::Document; +using RSS::Status; + +class KntSrcFilePropsFactory : public KLibFactory +{ + Q_OBJECT + + public: + virtual QObject *createObject(QObject * = 0, const char * = 0, + const char * = "QObject", const QStringList & = QStringList()); +}; + +class KntSrcFilePropsDlg : public KPropsDlgPlugin +{ + Q_OBJECT + + public: + KntSrcFilePropsDlg(KPropertiesDialog *); + + protected slots: + void slotOpenURL(const QString &); + void slotConstructUI(Loader *loader, Document doc, Status status); + void slotGotIcon(const KURL &, const QPixmap &); + void slotClickedArticle(QListBoxItem *); + + private: + KntSrcFilePropsDlgWidget *m_child; +}; + +#endif // KNTSRCFILEPROPSDLG_H diff --git a/knewsticker/kntsrcfilepropsdlg/kntsrcfilepropsdlgwidget.ui b/knewsticker/kntsrcfilepropsdlg/kntsrcfilepropsdlgwidget.ui new file mode 100644 index 00000000..b8d1827e --- /dev/null +++ b/knewsticker/kntsrcfilepropsdlg/kntsrcfilepropsdlgwidget.ui @@ -0,0 +1,215 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>KntSrcFilePropsDlgWidget</class> +<comment>The widget to be used for the RDF/RSS file properties dialog plugin.</comment> +<author>Frerich Raabe <raabe@kde.org></author> +<widget class="QWidget"> + <property name="name"> + <cstring>KntSrcFilePropsDlgWidget</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>311</width> + <height>274</height> + </rect> + </property> + <property name="layoutMargin" stdset="0"> + </property> + <property name="layoutSpacing" stdset="0"> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>4</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <spacer row="0" column="3"> + <property name="name"> + <cstring>Spacer5</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLabel" row="0" column="4"> + <property name="name"> + <cstring>pixmapIcon</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="pixmap"> + <pixmap>image0</pixmap> + </property> + <property name="toolTip" stdset="0"> + <string>Icon of this news site</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Here you can see the icon of this news site.</string> + </property> + </widget> + <widget class="KURLLabel" row="0" column="1" rowspan="1" colspan="2"> + <property name="name"> + <cstring>urlName</cstring> + </property> + <property name="text"> + <string>heise online news</string> + </property> + <property name="url" stdset="0"> + <string>http://www.heise.de/newsticker/</string> + </property> + </widget> + <widget class="QLabel" row="1" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>lDescription</cstring> + </property> + <property name="text"> + <string>Description:</string> + </property> + <property name="toolTip" stdset="0"> + <string>Brief description of the news site</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Here you can see a brief description about the news site and its contents.</string> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>lName</cstring> + </property> + <property name="text"> + <string>Name:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>leName</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Name of the news site</string> + </property> + <property name="whatsThis" stdset="0"> + <string>This is the name of the news site.</string> + </property> + </widget> + <widget class="QMultiLineEdit" row="1" column="2" rowspan="2" colspan="3"> + <property name="name"> + <cstring>mleDescription</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>4</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="wordWrap"> + <enum>WidgetWidth</enum> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + <property name="toolTip" stdset="0"> + <string>Brief description of the news site</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Here you can see a brief description about the news site and its contents.</string> + </property> + </widget> + <spacer row="2" column="0"> + <property name="name"> + <cstring>Spacer_2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Maximum</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>63</height> + </size> + </property> + </spacer> + <widget class="KSeparator" row="3" column="0" rowspan="1" colspan="5"> + <property name="name"> + <cstring>Line1</cstring> + </property> + <property name="orientation"> + <number>5</number> + </property> + </widget> + <widget class="QLabel" row="4" column="0" rowspan="1" colspan="5"> + <property name="name"> + <cstring>lArticles</cstring> + </property> + <property name="text"> + <string>Available articles:</string> + </property> + <property name="toolTip" stdset="0"> + <string>Articles contained within this source file</string> + </property> + <property name="whatsThis" stdset="0"> + <string>This list shows the headlines and links to the corresponding complete articles which have been stored in the source file whose properties you are watching.</string> + </property> + </widget> + <widget class="KListBox" row="5" column="0" rowspan="1" colspan="5"> + <property name="name"> + <cstring>lbArticles</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip" stdset="0"> + <string>Articles contained within this source file</string> + </property> + <property name="whatsThis" stdset="0"> + <string>This list shows the headlines and links to the corresponding complete articles which have been stored in the source file whose properties you are watching.<p>You can open the corresponding full article for each headline by, depending on the global KDE settings, clicking or double-clicking on a headline</string> + </property> + </widget> + </grid> +</widget> +<customwidgets> +</customwidgets> +<images> + <image name="image0"> + <data format="PNG" length="597">89504e470d0a1a0a0000000d49484452000000100000001008060000001ff3ff610000021c49444154388d8592316813511cc67f910c1770b8408704742838248260c63ad943974041533a84d0a1440a9ad6418a83dc22a853b62693c40c25e9503c07e93908ed601b3b354be90916ae43e10e2c5c06e1fed007714873b56daadff28ef7eefbf17dfff762db9d6dfe567db9dee73faa2c5662c3eff8c5c3dcdd1ca56209518216d7a2d5d9dba5b1d2c6b86f505faef787907300f393d91f9f4a621e7c8fccee5761e3dd3afa7503fbcb26e5f97294b4b25889c52f9aad9716e96c1614783f5d8c171318af0c365e6f401c76bbbb1164e1d9423f020ccc36b93b93983326fa988e73e462ab0fb8471ddc4397542a457ba54da3d9e0d0393c3f03e79b873e9e227f2b4f3693257d338d9be9e2adb9c82f8dfd837d961697f08e5ddc1ffb746e7469af5a5c1b02aa93d5583223f8be0f0ad64f5ad83b36c435509020017148eb29b299dbdccbe500ce0000b5871f639eefd149d9585b16aee7e2343d6a73358c0713a04242d543d334e4b77f193094bd639f99e76b4ccfe46935eb84aa87bdd64224403b2d3f12303457e7aa4c3fca8302949038bddae4581a11b91ac0964e32077a62d03f941ea562191414a60aa0403bfdf5d24b04683dad22aa070cccd66a83c2e30228419420be8f9c045727308fdf527eff865069241494662b589f6d44044d0112460946cf602da0dbddc4f75d421510f65c0ac53220880451922b2b548b26cc9a8804387bcea08eea8204034828ff9ec193e74ba3b647ea0f69200af223e8435e0000000049454e44ae426082</data> + </image> +</images> +<includes> + <include location="global" impldecl="in declaration">klistbox.h</include> + <include location="global" impldecl="in declaration">kurllabel.h</include> + <include location="global" impldecl="in declaration">kseparator.h</include> +</includes> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>kurllabel.h</includehint> + <includehint>kseparator.h</includehint> + <includehint>klistbox.h</includehint> +</includehints> +</UI> |