french -> French
[kdepim.git] / knode / knnntpaccount.h
blob131a72d81ee37dc663a9abe3808a8b4802d98e9c
1 /*
2 KNode, the KDE newsreader
3 Copyright (c) 1999-2005 the KNode authors.
4 See file AUTHORS for details
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
15 #ifndef KNNNTPACCOUNT_H
16 #define KNNNTPACCOUNT_H
18 #include "configuration/settings_container_interface.h"
19 #include "kncollection.h"
20 #include "knserverinfo.h"
22 #include <QObject>
23 #include <QDate>
25 class QTimer;
26 class KNNntpAccount;
27 namespace KNode {
28 class Cleanup;
30 namespace KPIMIdentities {
31 class Identity;
34 /** Handles the interval checking of an news server account. */
35 class KNNntpAccountIntervalChecking : public QObject {
37 Q_OBJECT
39 public:
40 explicit KNNntpAccountIntervalChecking(KNNntpAccount *account);
41 ~KNNntpAccountIntervalChecking();
42 void installTimer();
43 void deinstallTimer();
45 protected:
46 QTimer *t_imer;
47 KNNntpAccount *a_ccount;
49 protected slots:
50 void slotCheckNews();
55 /** Represents an account on a news server. */
56 class KNNntpAccount : public KNCollection , public KNServerInfo, public KNode::SettingsContainerInterface
58 public:
59 /**
60 * Shared pointer to a KNNntpAccount. To be used instead of raw KNNntpAccount*.
62 typedef boost::shared_ptr<KNNntpAccount> Ptr;
63 /**
64 * List of accounts.
66 typedef QList<KNNntpAccount::Ptr> List;
68 KNNntpAccount();
69 ~KNNntpAccount();
71 collectionType type() { return CTnntpAccount; }
73 /** tries to read information, returns false if it fails to do so */
74 bool readInfo(const QString &confPath);
75 void writeConfig();
76 //void syncInfo();
77 QString path();
78 /** returns true when the user accepted */
79 bool editProperties(QWidget *parent);
81 // news interval checking
82 void startTimer();
84 //get
85 bool fetchDescriptions() const { return f_etchDescriptions; }
86 QDate lastNewFetch() const { return l_astNewFetch; }
87 bool wasOpen() const { return w_asOpen; }
88 bool useDiskCache() const { return u_seDiskCache; }
90 /**
91 Returns this server's specific identity or
92 the null identity if there is none.
94 virtual const KPIMIdentities::Identity & identity() const;
95 /**
96 Sets this server's specific identity
97 @param identity this server's identity of a null identity to unset.
99 virtual void setIdentity( const KPIMIdentities::Identity &identity );
101 bool intervalChecking() const { return i_ntervalChecking; }
102 int checkInterval() const { return c_heckInterval; }
103 KNode::Cleanup *cleanupConfig() const { return mCleanupConf; }
105 /** Returns the cleanup configuration that should be used for this account */
106 KNode::Cleanup *activeCleanupConfig() const;
108 //set
109 void setFetchDescriptions(bool b) { f_etchDescriptions = b; }
110 void setLastNewFetch(QDate date) { l_astNewFetch = date; }
111 void setUseDiskCache(bool b) { u_seDiskCache=b; }
112 void setCheckInterval(int c);
113 void setIntervalChecking(bool b) { i_ntervalChecking=b; }
115 protected:
117 Unique object identifier of the identity of this server.
118 -1 means there is no specific identity for this group
119 (because KPIMIdentities::Identity::uoid() returns an unsigned int.
121 int mIdentityUoid;
122 /** account specific cleanup configuration */
123 KNode::Cleanup *mCleanupConf;
124 /** use an additional "list newsgroups" command to fetch the newsgroup descriptions */
125 bool f_etchDescriptions;
126 /** last use of "newgroups" */
127 QDate l_astNewFetch;
128 /** was the server open in the listview on the last shutdown? */
129 bool w_asOpen;
130 /** cache fetched articles on disk */
131 bool u_seDiskCache;
132 /** is interval checking enabled */
133 bool i_ntervalChecking;
134 int c_heckInterval;
136 /** helper class for news interval checking, manages the QTimer */
137 KNNntpAccountIntervalChecking *a_ccountIntervalChecking;
140 * Reimplemented from KNArticleCollection::selfPtr().
142 virtual KNCollection::Ptr selfPtr();
145 #endif