23 #include <kstandarddirs.h>
25 #include <kiconloader.h>
26 #include <kiconeffect.h>
45 QPixmap tempPix = UserIcon(
"greyball");
47 QImage tempImg=tempPix.toImage();
48 KIconEffect::colorize(tempImg,
knGlobals.settings()->readArticleColor(), 1.0);
49 i_cons[greyBall] = QPixmap::fromImage(tempImg);
51 tempImg=tempPix.toImage();
52 KIconEffect::colorize(tempImg,
knGlobals.settings()->unreadArticleColor(), 1.0);
53 i_cons[redBall] = QPixmap::fromImage(tempImg);
55 tempPix = UserIcon(
"greyballchk");
57 tempImg=tempPix.toImage();
58 KIconEffect::colorize(tempImg,
knGlobals.settings()->readArticleColor(), 1.0);
59 i_cons[greyBallChkd] = QPixmap::fromImage(tempImg);
61 tempImg=tempPix.toImage();
62 KIconEffect::colorize(tempImg,
knGlobals.settings()->unreadArticleColor(), 1.0);
63 i_cons[redBallChkd] = QPixmap::fromImage(tempImg);
72 QString fname( KStandardDirs::locate(
"data",
"knode/headers.rc" ) );
74 if (!fname.isNull()) {
75 KConfig headerConf( fname, KConfig::SimpleConfig);
76 QStringList headers = headerConf.groupList();
77 headers.removeAll(
"<default>");
83 QStringList::Iterator it;
84 for( it = headers.begin(); it != headers.end(); ++it ) {
86 KConfigGroup cg(&headerConf, (*it));
87 h->
setName(cg.readEntry(
"Name"));
91 if(h->
name().isNull() || h->
header().isNull() || (flags.count()!=8)) {
92 kDebug(5003) <<
"KNConfig::DisplayedHeaders::DisplayedHeaders() : ignoring invalid/incomplete Header";
96 for (
int i=0; i<8; ++i)
107 for ( KNDisplayedHeader::List::Iterator it = mHeaderList.begin(); it != mHeaderList.end(); ++it )
117 kDebug(5003) <<
"KNConfig::DisplayedHeaders::save()";
119 QString dir( KStandardDirs::locateLocal(
"data",
"knode/" ) );
124 KConfig headerConf(dir+
"headers.rc", KConfig::SimpleConfig);
125 QStringList oldHeaders = headerConf.groupList();
127 QStringList::Iterator oldIt=oldHeaders.begin();
128 for( ;oldIt != oldHeaders.end(); ++oldIt )
129 headerConf.deleteGroup((*oldIt));
135 for ( KNDisplayedHeader::List::Iterator it = mHeaderList.begin(); it != mHeaderList.end(); ++it ) {
137 while (group.length()<3)
139 KConfigGroup cg(&headerConf, group);
140 cg.writeEntry(
"Name",(*it)->name());
141 cg.writeEntry(
"Translate_Name",(*it)->translateName());
142 cg.writeEntry(
"Header",(*it)->header());
144 for (
int i=0; i<8; ++i) {
150 cg.writeEntry(
"Flags",flags);
160 mHeaderList.append( h );
168 if ( !mHeaderList.removeAll( h ) )
169 kDebug(5003) <<
"KNConfig::DisplayedHeaders::remove() : cannot find pointer in list!";
176 int idx = mHeaderList.indexOf( h );
178 mHeaderList.takeAt( idx );
179 mHeaderList.insert( idx - 1, h );
181 else kDebug(5003) <<
"KNConfig::DisplayedHeaders::up() : item not found in list";
187 int idx = mHeaderList.indexOf( h );
189 mHeaderList.takeAt( idx );
190 mHeaderList.insert( idx + 1, h );
192 else kDebug(5003) <<
"KNConfig::DisplayedHeaders::down() : item not found in list";
201 int pos = s.indexOf(
": ");
203 mName = s.left( pos );
205 mValue = s.right( s.length() - pos );
219 d_oExpire( true ), r_emoveUnavailable( true ), p_reserveThr( true ),
220 e_xpireInterval( 5 ), r_eadMaxAge( 10 ), u_nreadMaxAge( 15 ),
221 mGlobal(global), mDefault(!global), mLastExpDate( QDate::currentDate() )
232 d_oExpire = conf.readEntry(
"doExpire",
true );
233 r_emoveUnavailable = conf.readEntry(
"removeUnavailable",
true );
234 p_reserveThr = conf.readEntry(
"saveThreads",
true );
235 e_xpireInterval = conf.readEntry(
"expInterval", 5 );
236 r_eadMaxAge = conf.readEntry(
"readDays", 10 );
237 u_nreadMaxAge = conf.readEntry(
"unreadDays", 15 );
238 mLastExpDate = conf.readEntry(
"lastExpire", QDateTime() ).date();
242 d_oCompact = conf.readEntry(
"doCompact",
true );
243 c_ompactInterval = conf.readEntry(
"comInterval", 5 );
244 mLastCompDate = conf.readEntry(
"lastCompact", QDateTime() ).date();
248 mDefault = conf.readEntry(
"UseDefaultExpConf",
true );
255 conf.writeEntry(
"doExpire", d_oExpire );
256 conf.writeEntry(
"removeUnavailable", r_emoveUnavailable );
257 conf.writeEntry(
"saveThreads", p_reserveThr );
258 conf.writeEntry(
"expInterval", e_xpireInterval );
259 conf.writeEntry(
"readDays", r_eadMaxAge );
260 conf.writeEntry(
"unreadDays", u_nreadMaxAge );
261 conf.writeEntry(
"lastExpire", QDateTime(mLastExpDate) );
265 conf.writeEntry(
"doCompact", d_oCompact );
266 conf.writeEntry(
"comInterval", c_ompactInterval );
267 conf.writeEntry(
"lastCompact", QDateTime(mLastCompDate) );
271 conf.writeEntry(
"UseDefaultExpConf", mDefault );
279 kDebug(5003) <<
"KNConfig::Cleanup::save()";
281 KConfigGroup conf(
knGlobals.config(),
"EXPIRE" );
292 QDate today = QDate::currentDate();
293 if (mLastExpDate == today)
296 return (mLastExpDate.daysTo( today ) >= e_xpireInterval);
302 mLastExpDate = QDateTime::currentDateTime().date();
311 QDate today = QDate::currentDate();
312 if (mLastCompDate == today)
315 return (mLastCompDate.daysTo( today ) >= c_ompactInterval);
321 mLastCompDate = QDateTime::currentDateTime().date();
void setLastCompactDate()
void saveConfig(KConfigGroup &conf)
static void displayInternalFileError(QWidget *w=0)
use this for all internal files
Cleanup(bool global=true)
void loadConfig(const KConfigGroup &conf)
#define knGlobals
Keep compatibility with the old way.