• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

knode

  • sources
  • kde-4.12
  • kdepim
  • knode
kngroupmanager.cpp
Go to the documentation of this file.
1 /*
2  KNode, the KDE newsreader
3  Copyright (c) 1999-2006 the KNode authors.
4  See file AUTHORS for details
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10  You should have received a copy of the GNU General Public License
11  along with this program; if not, write to the Free Software Foundation,
12  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, US
13 */
14 
15 #include "kngroupmanager.h"
16 
17 #include "articlewidget.h"
18 #include "knmainwidget.h"
19 #include "knarticlemanager.h"
20 #include "kngroupdialog.h"
21 #include "knnntpaccount.h"
22 #include "kncleanup.h"
23 #include "scheduler.h"
24 #include "knglobals.h"
25 #include "knconfigmanager.h"
26 #include "nntpjobs.h"
27 #include "resource.h"
28 #include "knarticlewindow.h"
29 #include "knmemorymanager.h"
30 #include "settings.h"
31 #include "utils/locale.h"
32 
33 
34 #include <QByteArray>
35 #include <QDir>
36 #include <QFile>
37 
38 #include <klocale.h>
39 #include <kmessagebox.h>
40 #include <kiconloader.h>
41 #include <kdebug.h>
42 #include <kcharsets.h>
43 #include "knaccountmanager.h"
44 
45 
46 using namespace KNode;
47 using namespace KNode::Utilities;
48 
49 
50 //=================================================================================
51 
52 // helper classes for the group selection dialog (getting the server's grouplist,
53 // getting recently created groups)
54 
55 
56 KNGroupInfo::KNGroupInfo()
57 {
58 }
59 
60 
61 KNGroupInfo::KNGroupInfo(const QString &n_ame, const QString &d_escription, bool n_ewGroup, bool s_ubscribed, KNGroup::Status s_tatus)
62  : name(n_ame), description(d_escription), newGroup(n_ewGroup), subscribed(s_ubscribed),
63  status(s_tatus)
64 {
65 }
66 
67 
68 KNGroupInfo::~KNGroupInfo()
69 {
70 }
71 
72 
73 bool KNGroupInfo::operator== (const KNGroupInfo &gi2) const
74 {
75  return (name == gi2.name);
76 }
77 
78 
79 bool KNGroupInfo::operator< (const KNGroupInfo &gi2) const
80 {
81  return (name < gi2.name);
82 }
83 
84 
85 //===============================================================================
86 
87 
88 KNGroupListData::KNGroupListData()
89  : codecForDescriptions(0)
90 {
91  groups = new QList<KNGroupInfo>;
92 }
93 
94 
95 
96 KNGroupListData::~KNGroupListData()
97 {
98  delete groups;
99 }
100 
101 
102 
103 bool KNGroupListData::readIn(KNJobData *job)
104 {
105  QFile f( path + "groups" );
106  QByteArray line;
107  int sepPos1,sepPos2;
108  QString name,description;
109  bool sub;
110  KNGroup::Status status=KNGroup::unknown;
111  QTime timer;
112  uint size=f.size()+2;
113 
114  timer.start();
115  if(job) {
116  job->setProgress(0);
117  }
118 
119  if(f.open(QIODevice::ReadOnly)) {
120  while(!f.atEnd()) {
121  line = f.readLine();
122  sepPos1 = line.indexOf( ' ' );
123 
124  if (sepPos1==-1) { // no description
125  name = QString::fromUtf8(line);
126  description.clear();
127  status = KNGroup::unknown;
128  } else {
129  name = QString::fromUtf8(line.left(sepPos1));
130 
131  sepPos2 = line.indexOf( ' ', sepPos1 + 1 );
132  if (sepPos2==-1) { // no status
133  description = QString::fromUtf8(line.right(line.length()-sepPos1-1));
134  status = KNGroup::unknown;
135  } else {
136  description = QString::fromUtf8( line.right( line.length() - sepPos2 - 1 ).trimmed() );
137  switch (line[sepPos1+1]) {
138  case 'u': status = KNGroup::unknown;
139  break;
140  case 'n': status = KNGroup::readOnly;
141  break;
142  case 'y': status = KNGroup::postingAllowed;
143  break;
144  case 'm': status = KNGroup::moderated;
145  break;
146  }
147  }
148  }
149 
150  if (subscribed.contains(name)) {
151  subscribed.removeAll( name ); // group names are unique, we wont find it again anyway...
152  sub = true;
153  } else
154  sub = false;
155 
156  groups->append(KNGroupInfo(name,description,false,sub,status));
157 
158  if (timer.elapsed() > 200) { // don't flicker
159  timer.restart();
160  if(job) {
161  job->setProgress( (f.pos()*100)/size );
162  }
163  }
164  }
165 
166  f.close();
167  return true;
168  } else {
169  kWarning(5003) <<"unable to open" << f.fileName() <<" reason" << f.error();
170  return false;
171  }
172 }
173 
174 
175 
176 bool KNGroupListData::writeOut()
177 {
178  QFile f(path+"groups");
179  QByteArray temp;
180 
181  if(f.open(QIODevice::WriteOnly)) {
182  Q_FOREACH(const KNGroupInfo& i, *groups) {
183  temp = i.name.toUtf8();
184  switch (i.status) {
185  case KNGroup::unknown: temp += " u ";
186  break;
187  case KNGroup::readOnly: temp += " n ";
188  break;
189  case KNGroup::postingAllowed: temp += " y ";
190  break;
191  case KNGroup::moderated: temp += " m ";
192  break;
193  }
194  temp += i.description.toUtf8() + '\n';
195  f.write(temp.data(),temp.length());
196  }
197  f.close();
198  return true;
199  } else {
200  kWarning(5003) <<"unable to open" << f.fileName() <<" reason" << f.error();
201  return false;
202  }
203 }
204 
205 
206 
207 // merge in new groups, we want to preserve the "subscribed"-flag
208 // of the loaded groups and the "new"-flag of the new groups.
209 void KNGroupListData::merge(QList<KNGroupInfo>* newGroups)
210 {
211  bool subscribed;
212 
213  Q_FOREACH(const KNGroupInfo& i, *newGroups) {
214  int current;
215  if ( (current=groups->indexOf(i)) != -1) {
216  subscribed = groups->at(current).subscribed;
217  groups->removeAt(current); // avoid duplicates
218  } else
219  subscribed = false;
220  groups->append(KNGroupInfo(i.name,i.description,true,subscribed,i.status));
221  }
222 }
223 
224 
225 QList<KNGroupInfo>* KNGroupListData::extractList()
226 {
227  QList<KNGroupInfo>* temp = groups;
228  groups = 0;
229  return temp;
230 }
231 
232 
233 //===============================================================================
234 
235 
236 KNGroupManager::KNGroupManager( QObject * parent )
237  : QObject( parent )
238 {
239  a_rticleMgr = knGlobals.articleManager();
240 }
241 
242 
243 KNGroupManager::~KNGroupManager()
244 {
245 }
246 
247 
248 void KNGroupManager::syncGroups()
249 {
250  for ( KNGroup::List::Iterator it = mGroupList.begin(); it != mGroupList.end(); ++it ) {
251  (*it)->syncDynamicData();
252  (*it)->writeConfig();
253  }
254 }
255 
256 
257 void KNGroupManager::loadGroups( KNNntpAccount::Ptr a )
258 {
259  KNGroup::Ptr group;
260 
261  QString dir(a->path());
262  if (dir.isNull())
263  return;
264  QDir d(dir);
265 
266  QStringList entries(d.entryList(QStringList("*.grpinfo")));
267  for(QStringList::Iterator it=entries.begin(); it != entries.end(); ++it) {
268  group = KNGroup::Ptr( new KNGroup( a ) );
269  if (group->readInfo(dir+(*it))) {
270  mGroupList.append( group );
271  emit groupAdded(group);
272  } else {
273  kError(5003) <<"Unable to load" << (*it) <<"!";
274  }
275  }
276 }
277 
278 
279 void KNGroupManager::getSubscribed( KNNntpAccount::Ptr a, QStringList &l )
280 {
281  l.clear();
282  for ( KNGroup::List::Iterator it = mGroupList.begin(); it != mGroupList.end(); ++it )
283  if ( (*it)->account() == a )
284  l.append( (*it)->groupname() );
285 }
286 
287 
288 KNGroup::List KNGroupManager::groupsOfAccount( KNNntpAccount::Ptr a )
289 {
290  KNGroup::List ret;
291  for ( KNGroup::List::Iterator it = mGroupList.begin(); it != mGroupList.end(); ++it )
292  if ( (*it)->account() == a )
293  ret.append( (*it) );
294  return ret;
295 }
296 
297 
298 bool KNGroupManager::loadHeaders( KNGroup::Ptr g )
299 {
300  if (!g)
301  return false;
302 
303  if (g->isLoaded())
304  return true;
305 
306  // we want to delete old stuff first => reduce vm fragmentation
307  knGlobals.memoryManager()->prepareLoad(g);
308 
309  if (g->loadHdrs()) {
310  knGlobals.memoryManager()->updateCacheEntry( boost::static_pointer_cast<KNArticleCollection>( g ) );
311  return true;
312  }
313 
314  return false;
315 }
316 
317 
318 bool KNGroupManager::unloadHeaders( KNGroup::Ptr g, bool force )
319 {
320  if(!g || g->isLocked())
321  return false;
322 
323  if(!g->isLoaded())
324  return true;
325 
326  if (!force && (c_urrentGroup == g))
327  return false;
328 
329  if (g->unloadHdrs(force))
330  knGlobals.memoryManager()->removeCacheEntry( boost::static_pointer_cast<KNArticleCollection>( g ) );
331  else
332  return false;
333 
334  return true;
335 }
336 
337 
338 KNGroup::Ptr KNGroupManager::group( const QString &gName, const KNServerInfo::Ptr s )
339 {
340  for ( KNGroup::List::Iterator it = mGroupList.begin(); it != mGroupList.end(); ++it )
341  if ( (*it)->account() == s && (*it)->groupname() == gName )
342  return (*it);
343 
344  return KNGroup::Ptr();
345 }
346 
347 
348 KNGroup::Ptr KNGroupManager::firstGroupOfAccount( const KNServerInfo::Ptr s )
349 {
350  for ( KNGroup::List::Iterator it = mGroupList.begin(); it != mGroupList.end(); ++it )
351  if ( (*it)->account() == s )
352  return (*it);
353 
354  return KNGroup::Ptr();
355 }
356 
357 
358 void KNGroupManager::expireAll(KNCleanUp *cup)
359 {
360  for ( KNGroup::List::Iterator it = mGroupList.begin(); it != mGroupList.end(); ++it ) {
361  if( (*it)->isLocked() || (*it)->lockedArticles() > 0 )
362  continue;
363  if ( !(*it)->activeCleanupConfig()->expireToday() )
364  continue;
365  cup->appendCollection( *(it) );
366  }
367 }
368 
369 
370 void KNGroupManager::expireAll( KNNntpAccount::Ptr a )
371 {
372  KNCleanUp *cup = new KNCleanUp();
373 
374  for ( KNGroup::List::Iterator it = mGroupList.begin(); it != mGroupList.end(); ++it ) {
375  if( (*it)->account() != a || (*it)->isLocked() || (*it)->lockedArticles() > 0 )
376  continue;
377 
378  ArticleWindow::closeAllWindowsForCollection( (*it) );
379  cup->appendCollection( (*it) );
380  }
381 
382  cup->start();
383 
384  for ( KNGroup::List::Iterator it = mGroupList.begin(); it != mGroupList.end(); ++it ) {
385  if( (*it)->account() != a || (*it)->isLocked() || (*it)->lockedArticles() > 0 )
386  continue;
387 
388  emit groupUpdated( (*it) );
389  if ( (*it) == c_urrentGroup ) {
390  if ( loadHeaders( (*it) ) )
391  a_rticleMgr->showHdrs();
392  else
393  a_rticleMgr->setGroup( KNGroup::Ptr() );
394  }
395  }
396 
397  delete cup;
398 }
399 
400 
401 void KNGroupManager::showGroupDialog( KNNntpAccount::Ptr a, QWidget *parent )
402 {
403  KNGroupDialog* gDialog=new KNGroupDialog((parent!=0)? parent:knGlobals.topWidget, a);
404 
405  connect( gDialog, SIGNAL(loadList(KNNntpAccount::Ptr)), this, SLOT(slotLoadGroupList(KNNntpAccount::Ptr)) );
406  connect( gDialog, SIGNAL(fetchList(KNNntpAccount::Ptr)), this, SLOT(slotFetchGroupList(KNNntpAccount::Ptr)) );
407  connect( gDialog, SIGNAL(checkNew(KNNntpAccount::Ptr,QDate)), this, SLOT(slotCheckForNewGroups(KNNntpAccount::Ptr,QDate)) );
408  connect( this, SIGNAL(newListReady(KNGroupListData::Ptr)), gDialog, SLOT(slotReceiveList(KNGroupListData::Ptr)) );
409 
410  QWidget *oldTopWidget = knGlobals.topWidget;
411  // if the list of groups is empty, the parent of the message box
412  // asking whether to fetch will be "knGlobals.topWidget"
413  knGlobals.topWidget = gDialog;
414  int accept = gDialog->exec();
415  knGlobals.topWidget = oldTopWidget;
416  if(accept) {
417  KNGroup::Ptr g;
418 
419  QStringList lst;
420  gDialog->toUnsubscribe(&lst);
421  if (lst.count()>0) {
422  if (KMessageBox::Yes == KMessageBox::questionYesNoList((parent!=0)? parent:knGlobals.topWidget,i18n("Do you really want to unsubscribe\nfrom these groups?"),
423  lst, QString(), KGuiItem(i18n("Unsubscribe")), KStandardGuiItem::cancel())) {
424  for ( QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) {
425  if((g=group(*it, a)))
426  unsubscribeGroup(g);
427  }
428  }
429  }
430 
431  QList<KNGroupInfo> lst2;
432  gDialog->toSubscribe(&lst2);
433  Q_FOREACH( const KNGroupInfo& var, lst2) {
434  subscribeGroup(&var, a);
435  }
436  }
437 
438  delete gDialog;
439 }
440 
441 
442 void KNGroupManager::subscribeGroup( const KNGroupInfo *gi, KNNntpAccount::Ptr a )
443 {
444  KNGroup::Ptr grp = KNGroup::Ptr( new KNGroup( a ) );
445  grp->setGroupname(gi->name);
446  grp->setDescription(gi->description);
447  grp->setStatus(gi->status);
448  grp->writeConfig();
449  mGroupList.append( grp );
450  emit groupAdded(grp);
451 }
452 
453 
454 bool KNGroupManager::unsubscribeGroup( KNGroup::Ptr g )
455 {
456  KNNntpAccount::Ptr acc;
457  if(!g) g=c_urrentGroup;
458  if(!g) return false;
459 
460  if((g->isLocked()) || (g->lockedArticles()>0)) {
461  KMessageBox::sorry(knGlobals.topWidget, i18n("The group \"%1\" is being updated currently.\nIt is not possible to unsubscribe from it at the moment.", g->groupname()));
462  return false;
463  }
464 
465  ArticleWindow::closeAllWindowsForCollection( g );
466  ArticleWidget::collectionRemoved( g );
467 
468  acc=g->account();
469 
470  QDir dir( acc->path(), g->groupname() + '*' );
471  if (dir.exists()) {
472  if (unloadHeaders(g, true)) {
473  if(c_urrentGroup==g) {
474  setCurrentGroup( KNGroup::Ptr() );
475  a_rticleMgr->updateStatusString();
476  }
477 
478  QFileInfoList list = dir.entryInfoList(); // get list of matching files and delete all
479  Q_FOREACH( const QFileInfo &it, list ) {
480  if ( it.fileName() == g->groupname()+".dynamic" ||
481  it.fileName() == g->groupname()+".static" ||
482  it.fileName() == g->groupname()+".grpinfo" )
483  dir.remove( it.fileName() );
484  }
485  kDebug(5003) <<"Files deleted!";
486 
487  emit groupRemoved(g);
488  mGroupList.removeAll( g );
489 
490  return true;
491  }
492  }
493 
494  return false;
495 }
496 
497 
498 void KNGroupManager::showGroupProperties( KNGroup::Ptr g )
499 {
500  if(!g) g=c_urrentGroup;
501  if(!g) return;
502  g->showProperties();
503 }
504 
505 
506 void KNGroupManager::checkGroupForNewHeaders( KNGroup::Ptr g )
507 {
508  if(!g) g=c_urrentGroup;
509  if(!g) return;
510  if(g->isLocked()) {
511  kDebug(5003) <<"KNGroupManager::checkGroupForNewHeaders() : group locked - returning";
512  return;
513  }
514 
515  g->setMaxFetch( knGlobals.settings()->maxToFetch() );
516  emitJob( new ArticleListJob( this, g->account(), g ) );
517 }
518 
519 
520 void KNGroupManager::expireGroupNow( KNGroup::Ptr g )
521 {
522  if(!g) return;
523 
524  if((g->isLocked()) || (g->lockedArticles()>0)) {
525  KMessageBox::sorry(knGlobals.topWidget,
526  i18n("This group cannot be expired because it is currently being updated.\n Please try again later."));
527  return;
528  }
529 
530  ArticleWindow::closeAllWindowsForCollection( g );
531 
532  KNCleanUp cup;
533  cup.expireGroup(g, true);
534 
535  emit groupUpdated(g);
536  if(g==c_urrentGroup) {
537  if( loadHeaders(g) )
538  a_rticleMgr->showHdrs();
539  else
540  a_rticleMgr->setGroup( KNGroup::Ptr() );
541  }
542 }
543 
544 
545 void KNGroupManager::reorganizeGroup( KNGroup::Ptr g )
546 {
547  if(!g) g=c_urrentGroup;
548  if(!g) return;
549  g->reorganize();
550  if(g==c_urrentGroup)
551  a_rticleMgr->showHdrs();
552 }
553 
554 
555 void KNGroupManager::setCurrentGroup( KNGroup::Ptr g )
556 {
557  c_urrentGroup=g;
558  a_rticleMgr->setGroup(g);
559  kDebug(5003) <<"KNGroupManager::setCurrentGroup() : group changed";
560 
561  if(g) {
562  if( !loadHeaders(g) ) {
563  //KMessageBox::error(knGlobals.topWidget, i18n("Cannot load saved headers"));
564  return;
565  }
566  a_rticleMgr->showHdrs();
567  if ( knGlobals.settings()->autoCheckGroups() )
568  checkGroupForNewHeaders(g);
569  }
570 }
571 
572 
573 void KNGroupManager::checkAll( KNNntpAccount::Ptr a, bool silent )
574 {
575  if(!a) return;
576 
577  for ( KNGroup::List::Iterator it = mGroupList.begin(); it != mGroupList.end(); ++it ) {
578  if ( (*it)->account() == a ) {
579  (*it)->setMaxFetch( knGlobals.settings()->maxToFetch() );
580  emitJob( new ArticleListJob( this, (*it)->account(), boost::shared_ptr<KNJobItem>( *it ), silent ) );
581  }
582  }
583 }
584 
585 void KNGroupManager::checkAll( int id, bool silent )
586 {
587  KNNntpAccount::Ptr account = KNGlobals::self()->accountManager()->account( id );
588  checkAll( account, silent );
589 }
590 
591 
592 void KNGroupManager::processJob(KNJobData *j)
593 {
594  if ( j->type()==KNJobData::JTLoadGroups || j->type()==KNJobData::JTFetchGroups ) {
595  KNGroupListData::Ptr d = boost::static_pointer_cast<KNGroupListData>( j->data() );
596 
597  if (!j->canceled()) {
598  if (j->success()) {
599  if ( j->type() == KNJobData::JTFetchGroups ) {
600  // update the descriptions of the subscribed groups
601  foreach ( const KNGroup::Ptr &grp, mGroupList ) {
602  if ( grp->account() == j->account() ) {
603  foreach ( const KNGroupInfo &inf, *(d->groups) ) {
604  if ( inf.name == grp->groupname() ) {
605  grp->setDescription( inf.description );
606  grp->setStatus( inf.status );
607  break;
608  }
609  }
610  }
611  }
612  }
613  emit( newListReady( d ) );
614  } else {
615  KMessageBox::error(knGlobals.topWidget, j->errorString());
616  emit( newListReady( KNGroupListData::Ptr() ) );
617  }
618  } else {
619  emit( newListReady( KNGroupListData::Ptr() ) );
620  }
621 
622  delete j;
623 
624  } else { //KNJobData::JTfetchNewHeaders
625  KNGroup::Ptr group = boost::static_pointer_cast<KNGroup>( j->data() );
626 
627  if (!j->canceled()) {
628  if (j->success()) {
629  if(group->lastFetchCount()>0) {
630  group->scoreArticles();
631  group->processXPostBuffer(true);
632  emit groupUpdated( group );
633  group->writeConfig();
634  knGlobals.memoryManager()->updateCacheEntry( boost::static_pointer_cast<KNArticleCollection>( group ) );
635  }
636  } else {
637  // ok, hack (?):
638  // stop all other active fetch jobs, this prevents that
639  // we show multiple error dialogs if a server is unavailable
640  knGlobals.scheduler()->cancelJobs( KNJobData::JTfetchNewHeaders );
641  ArticleListJob *lj = static_cast<ArticleListJob*>( j );
642  if ( !lj->silent() ) {
643  QString errorMsg = j->errorString();
644  if( j->error() == KIO::ERR_DOES_NOT_EXIST ) {
645  errorMsg = i18n( "The group %1 does not appear to exist anymore on the server.\n"
646  "You may unsubscribe.",
647  group->name() );
648  }
649  KMessageBox::error( knGlobals.topWidget, errorMsg );
650  }
651  }
652  }
653  if( group == c_urrentGroup ) {
654  a_rticleMgr->showHdrs(false);
655  }
656 
657  delete j;
658  }
659 }
660 
661 
662 // load group list from disk (if this fails: ask user if we should fetch the list)
663 void KNGroupManager::slotLoadGroupList( KNNntpAccount::Ptr a )
664 {
665  KNGroupListData::Ptr d = KNGroupListData::Ptr( new KNGroupListData() );
666  d->path = a->path();
667 
668  if(!QFileInfo(d->path+"groups").exists()) {
669  if (KMessageBox::Yes==KMessageBox::questionYesNo(knGlobals.topWidget,i18n("You do not have any groups for this account;\ndo you want to fetch a current list?"), QString(), KGuiItem(i18n("Fetch List")), KGuiItem(i18n("Do Not Fetch")))) {
670  slotFetchGroupList(a);
671  return;
672  } else {
673  emit( newListReady( d ) );
674  return;
675  }
676  }
677 
678  getSubscribed(a,d->subscribed);
679  d->getDescriptions = a->fetchDescriptions();
680 
681  emitJob( new GroupLoadJob( this, a, d ) );
682 }
683 
684 
685 // fetch group list from server
686 void KNGroupManager::slotFetchGroupList( KNNntpAccount::Ptr a )
687 {
688  KNGroupListData::Ptr d = KNGroupListData::Ptr( new KNGroupListData() );
689  d->path = a->path();
690  getSubscribed(a,d->subscribed);
691  d->getDescriptions = a->fetchDescriptions();
692  d->codecForDescriptions = KGlobal::charsets()->codecForName( Locale::defaultCharset() );
693 
694  emitJob( new GroupListJob( this, a, d ) );
695 }
696 
697 
698 // check for new groups (created after the given date)
699 void KNGroupManager::slotCheckForNewGroups( KNNntpAccount::Ptr a, QDate date )
700 {
701  KNGroupListData::Ptr d = KNGroupListData::Ptr( new KNGroupListData() );
702  d->path = a->path();
703  getSubscribed(a,d->subscribed);
704  d->getDescriptions = a->fetchDescriptions();
705  d->fetchSince = date;
706  d->codecForDescriptions = KGlobal::charsets()->codecForName( Locale::defaultCharset() );
707 
708  emitJob( new GroupListJob( this, a, d, true ) );
709 }
710 
711 
712 //--------------------------------
713 
714 #include "kngroupmanager.moc"
KNGroupManager::newListReady
void newListReady(KNGroupListData::Ptr d)
KNGroupInfo::KNGroupInfo
KNGroupInfo()
Definition: kngroupmanager.cpp:56
KNGroupInfo::description
QString description
Definition: kngroupmanager.h:43
KNGroupManager::syncGroups
void syncGroups()
Definition: kngroupmanager.cpp:248
KNGroupManager::expireGroupNow
void expireGroupNow(KNGroup::Ptr g=KNGroup::Ptr())
Definition: kngroupmanager.cpp:520
KNGroup::scoreArticles
void scoreArticles(bool onlynew=true)
Definition: kngroup.cpp:909
KNGroupListData::extractList
QList< KNGroupInfo > * extractList()
Definition: kngroupmanager.cpp:225
KNGroupManager::groupsOfAccount
KNGroup::List groupsOfAccount(KNNntpAccount::Ptr a)
Returns the list of (subscribed) groups in the account a.
Definition: kngroupmanager.cpp:288
KNCleanUp::expireGroup
void expireGroup(KNGroup::Ptr g, bool showResult=false)
Definition: kncleanup.cpp:88
KNJobData::JTLoadGroups
Definition: knjobdata.h:109
KNGroupManager::getSubscribed
void getSubscribed(KNNntpAccount::Ptr a, QStringList &l)
Definition: kngroupmanager.cpp:279
knmemorymanager.h
kngroupdialog.h
KNGroupManager::~KNGroupManager
~KNGroupManager()
Definition: kngroupmanager.cpp:243
KNJobConsumer::emitJob
void emitJob(KNJobData *j)
Send the job to the scheduler and append it to the job queue.
Definition: knjobdata.cpp:42
KNGroupManager::showGroupDialog
void showGroupDialog(KNNntpAccount::Ptr a, QWidget *parent=0)
Definition: kngroupmanager.cpp:401
KNGroupManager::reorganizeGroup
void reorganizeGroup(KNGroup::Ptr g=KNGroup::Ptr())
Definition: kngroupmanager.cpp:545
KNGroup::moderated
Definition: kngroup.h:50
KNGroupManager::checkAll
void checkAll(KNNntpAccount::Ptr a, bool silent=false)
Definition: kngroupmanager.cpp:573
KNGroup::Status
Status
The posting rights status of this group.
Definition: kngroup.h:50
KNGroupDialog
New group subscription dialog.
Definition: kngroupdialog.h:22
date
time_t date() const
KNGroupManager::group
KNGroup::Ptr group(const QString &gName, const KNServerInfo::Ptr s)
Returns a group named gName in the server s, or null if none is found.
Definition: kngroupmanager.cpp:338
KNGroupManager::loadGroups
void loadGroups(KNNntpAccount::Ptr a)
Definition: kngroupmanager.cpp:257
KNGroupListData::Ptr
boost::shared_ptr< KNGroupListData > Ptr
Shared pointer to a KNGroupListData.
Definition: kngroupmanager.h:59
KNJobData
Abstract base class for all KNode internal jobs.
Definition: knjobdata.h:101
KNode::ArticleListJob::silent
bool silent()
Returns whether an error message should be shown.
Definition: nntpjobs.h:69
articlewidget.h
QWidget
KNGroupDialog::toUnsubscribe
void toUnsubscribe(QStringList *l)
Definition: kngroupdialog.cpp:148
knaccountmanager.h
KNGroupManager::a_rticleMgr
KNArticleManager * a_rticleMgr
Definition: kngroupmanager.h:151
KNode::ArticleListJob
Downloads all or a selected part of the article list for a specific newsgroup.
Definition: nntpjobs.h:61
KNGroupManager::unsubscribeGroup
bool unsubscribeGroup(KNGroup::Ptr g=KNGroup::Ptr())
Definition: kngroupmanager.cpp:454
KNGlobals::self
static KNGlobals * self()
Return the KNGlobals instance.
Definition: knglobals.cpp:72
KNGroupDialog::toSubscribe
void toSubscribe(QList< KNGroupInfo > *l)
Definition: kngroupdialog.cpp:128
kngroupmanager.h
KNGroupListData::merge
void merge(QList< KNGroupInfo > *newGroups)
Definition: kngroupmanager.cpp:209
KNGroup
Representation of a news group.
Definition: kngroup.h:41
QObject
knarticlemanager.h
KNode::GroupLoadJob
Loads the newsgroup list from the disk.
Definition: nntpjobs.h:48
knarticlewindow.h
KNNntpAccount::Ptr
boost::shared_ptr< KNNntpAccount > Ptr
Shared pointer to a KNNntpAccount.
Definition: knnntpaccount.h:62
KNCleanUp
This class handles group expiration and folder compaction.
Definition: kncleanup.h:36
knnntpaccount.h
KNGroupManager::KNGroupManager
KNGroupManager(QObject *parent=0)
Definition: kngroupmanager.cpp:236
nntpjobs.h
scheduler.h
KNGroupManager::groupAdded
void groupAdded(KNGroup::Ptr g)
Emitted when a group is added.
KNGroupManager::expireAll
void expireAll(KNCleanUp *cup)
Definition: kngroupmanager.cpp:358
KNGroupManager::subscribeGroup
void subscribeGroup(const KNGroupInfo *gi, KNNntpAccount::Ptr a)
Definition: kngroupmanager.cpp:442
KNGroupManager::mGroupList
KNGroup::List mGroupList
Definition: kngroupmanager.h:149
KNGroupListData::writeOut
bool writeOut()
Definition: kngroupmanager.cpp:176
KNJobData::JTFetchGroups
Definition: knjobdata.h:110
KNGroupListData::~KNGroupListData
~KNGroupListData()
Definition: kngroupmanager.cpp:96
KNGroupManager::groupRemoved
void groupRemoved(KNGroup::Ptr g)
Emitted when a group is removed.
KNGroup::readOnly
Definition: kngroup.h:50
KNGroupManager::slotFetchGroupList
void slotFetchGroupList(KNNntpAccount::Ptr a)
fetch group list from server
Definition: kngroupmanager.cpp:686
KNJobData::type
jobType type() const
Definition: knjobdata.h:120
KNGroupManager::checkGroupForNewHeaders
void checkGroupForNewHeaders(KNGroup::Ptr g=KNGroup::Ptr())
Definition: kngroupmanager.cpp:506
KNGroupInfo::name
QString name
group names will be utf-8 encoded in the future...
Definition: kngroupmanager.h:43
KNGroup::postingAllowed
Definition: kngroup.h:50
KNGroupManager::c_urrentGroup
KNGroup::Ptr c_urrentGroup
Definition: kngroupmanager.h:150
KNJobData::data
KNJobItem::Ptr data() const
Definition: knjobdata.h:123
KNJobData::account
KNServerInfo::Ptr account() const
Definition: knjobdata.h:122
KNGroup::unknown
Definition: kngroup.h:50
locale.h
knmainwidget.h
resource.h
KNCleanUp::appendCollection
void appendCollection(KNArticleCollection::Ptr c)
Add a collection to handle.
Definition: kncleanup.h:45
KNJobData::canceled
bool canceled() const
Returns true if the job has been canceled by the user.
Definition: knjobdata.h:132
KNJobData::JTfetchNewHeaders
Definition: knjobdata.h:111
KNGroupManager::slotLoadGroupList
void slotLoadGroupList(KNNntpAccount::Ptr a)
load group list from disk (if this fails: ask user if we should fetch the list)
Definition: kngroupmanager.cpp:663
KNGroupManager::processJob
void processJob(KNJobData *j)
Reimplemented from KNJobConsumer.
Definition: kngroupmanager.cpp:592
KNCleanUp::start
void start()
Definition: kncleanup.cpp:52
KNGroupManager::loadHeaders
bool loadHeaders(KNGroup::Ptr g)
Definition: kngroupmanager.cpp:298
KNGroupManager::setCurrentGroup
void setCurrentGroup(KNGroup::Ptr g)
Definition: kngroupmanager.cpp:555
knglobals.h
KNJobData::errorString
QString errorString() const
Returns the error message.
Definition: knjobdata.h:128
KNArticleManager::updateStatusString
void updateStatusString()
Definition: knarticlemanager.cpp:1001
KNGroupListData
Data of group list jobs.
Definition: kngroupmanager.h:53
KNGroupManager::showGroupProperties
void showGroupProperties(KNGroup::Ptr g=KNGroup::Ptr())
Shows the property dialog of g or if null, the properties of the currentGroup().
Definition: kngroupmanager.cpp:498
settings.h
KNGroupListData::path
QString path
Definition: kngroupmanager.h:71
KNGroupListData::readIn
bool readIn(KNJobData *job=0)
Definition: kngroupmanager.cpp:103
KNJobData::setProgress
void setProgress(unsigned int progress)
Set the progress value of the progress item if available.
Definition: knjobdata.h:168
KNJobData::success
bool success() const
Returns true if the job finished successfully.
Definition: knjobdata.h:130
KNGroupListData::groups
QList< KNGroupInfo > * groups
Definition: kngroupmanager.h:72
kncleanup.h
KNGroupInfo::operator==
bool operator==(const KNGroupInfo &gi2) const
Definition: kngroupmanager.cpp:73
knconfigmanager.h
KNServerInfo::Ptr
boost::shared_ptr< KNServerInfo > Ptr
Shared pointer to a KNServerInfo.
Definition: knserverinfo.h:37
KNGroupManager::firstGroupOfAccount
KNGroup::Ptr firstGroupOfAccount(const KNServerInfo::Ptr s)
Returns the first group in the server s, or null if it is empty.
Definition: kngroupmanager.cpp:348
KNJobData::error
int error() const
Returns the error code (see KIO::Error).
Definition: knjobdata.h:126
KNArticleManager::showHdrs
void showHdrs(bool clear=true)
Definition: knarticlemanager.cpp:181
KNGroupInfo::operator<
bool operator<(const KNGroupInfo &gi2) const
Definition: kngroupmanager.cpp:79
knGlobals
#define knGlobals
Keep compatibility with the old way.
Definition: knglobals.h:28
KNGroupListData::subscribed
QStringList subscribed
Definition: kngroupmanager.h:70
KNGlobals::accountManager
KNAccountManager * accountManager()
Returns the account manager.
Definition: knglobals.cpp:110
KNGroupInfo
Helper classes for the group selection dialog, contains info about a newsgroup (name, description)
Definition: kngroupmanager.h:34
KNAccountManager::account
KNNntpAccount::Ptr account(int id)
Returns the account with the given id.
Definition: knaccountmanager.cpp:84
KNGroupManager::unloadHeaders
bool unloadHeaders(KNGroup::Ptr g, bool force=true)
Definition: kngroupmanager.cpp:318
KNGroupInfo::~KNGroupInfo
~KNGroupInfo()
Definition: kngroupmanager.cpp:68
KNArticleManager::setGroup
void setGroup(KNGroup::Ptr g)
Definition: knarticlemanager.cpp:406
KNGroupManager::groupUpdated
void groupUpdated(KNGroup::Ptr g)
Emitted when a group is updated.
KNGroupInfo::status
KNGroup::Status status
Definition: kngroupmanager.h:45
KNGroupManager::slotCheckForNewGroups
void slotCheckForNewGroups(KNNntpAccount::Ptr a, QDate date)
check for new groups (created after the given date)
Definition: kngroupmanager.cpp:699
KNode::GroupListJob
Download and update newsgroups lists.
Definition: nntpjobs.h:28
QList< KNGroupInfo >
KNGroup::Ptr
boost::shared_ptr< KNGroup > Ptr
Shared pointer to a KNGroup.
Definition: kngroup.h:47
KNGroupListData::KNGroupListData
KNGroupListData()
Definition: kngroupmanager.cpp:88
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:58:36 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

knode

Skip menu "knode"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal