20 #include "summaryview_plugin.h"
22 #include "summaryview_part.h"
25 #include <kgenericfactory.h>
26 #include <tdeparts/componentfactory.h>
27 #include <tdeaboutdata.h>
28 #include <tdeaction.h>
30 #include <tqpopupmenu.h>
32 typedef KGenericFactory< SummaryView, Kontact::Core > SummaryViewFactory;
33 K_EXPORT_COMPONENT_FACTORY( libkontact_summaryplugin,
34 SummaryViewFactory(
"kontact_summaryplugin" ) )
36 SummaryView::SummaryView( Kontact::Core *core, const
char *name, const TQStringList& )
37 : Kontact::Plugin( core, core, name),
38 mAboutData( 0 ), mPart( 0 )
40 setInstance( SummaryViewFactory::instance() );
42 mSyncAction =
new TDESelectAction( i18n(
"Synchronize All" ),
"reload", 0, 0,
43 0, actionCollection(),
44 "kontact_summary_sync" );
45 connect( mSyncAction, TQ_SIGNAL( activated(
const TQString& ) ),
this, TQ_SLOT( syncAccount(
const TQString& ) ) );
46 connect( mSyncAction->popupMenu(), TQ_SIGNAL( aboutToShow() ),
this, TQ_SLOT( fillSyncActionSubEntries() ) );
48 insertSyncAction( mSyncAction );
49 fillSyncActionSubEntries();
52 void SummaryView::fillSyncActionSubEntries()
54 TQStringList menuItems;
55 menuItems.append( i18n(
"All") );
57 DCOPRef ref(
"kmail",
"KMailIface" );
58 DCOPReply reply = ref.call(
"accounts" );
60 if ( reply.isValid() )
62 const TQStringList accounts = reply;
63 menuItems += accounts;
66 mSyncAction->setItems( menuItems );
69 void SummaryView::syncAccount(
const TQString& account )
71 if ( account == i18n(
"All") ) {
74 DCOPRef ref(
"kmail",
"KMailIface" );
75 ref.send(
"checkAccount", account );
77 fillSyncActionSubEntries();
80 SummaryView::~SummaryView()
84 void SummaryView::doSync()
87 mPart->updateSummaries();
89 const TQValueList<Kontact::Plugin*> pluginList = core()->pluginList();
90 for ( TQValueList<Kontact::Plugin*>::ConstIterator it = pluginList.begin(), end = pluginList.end();
93 TQPtrList<TDEAction> *actions = (*it)->syncActions();
94 for ( TQPtrList<TDEAction>::Iterator jt = actions->begin(), end = actions->end(); jt != end; ++jt ) {
95 if ( *jt != mSyncAction )
99 fillSyncActionSubEntries();
102 KParts::ReadOnlyPart *SummaryView::createPart()
104 mPart =
new SummaryViewPart( core(),
"summarypartframe", aboutData(),
105 this,
"summarypart" );
109 const TDEAboutData *SummaryView::aboutData()
112 mAboutData =
new TDEAboutData(
"kontactsummary", I18N_NOOP(
"Kontact Summary"),
114 I18N_NOOP(
"Kontact Summary View"),
115 TDEAboutData::License_LGPL,
116 I18N_NOOP(
"(c) 2003 The Kontact developers" ) );
117 mAboutData->addAuthor(
"Sven Lueppken",
"",
"sven@kde.org" );
118 mAboutData->addAuthor(
"Cornelius Schumacher",
"",
"schumacher@kde.org" );
119 mAboutData->addAuthor(
"Tobias Koenig",
"",
"tokoe@kde.org" );
120 mAboutData->setProductName(
"kontact/summary" );
126 #include "summaryview_plugin.moc"