1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
/*
KNode, the KDE newsreader
Copyright (c) 1999-2005 the KNode authors.
See file AUTHORS for details
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, US
*/
#include <tqstring.h>
#include <kwin.h>
#include <kscoringeditor.h>
#include "knscoring.h"
#include "knaccountmanager.h"
#include "kngroupmanager.h"
#include "utilities.h"
#include "knglobals.h"
//----------------------------------------------------------------------------
NotifyCollection* KNScorableArticle::notifyC = 0;
KNScorableArticle::KNScorableArticle(KNRemoteArticle* a)
: ScorableArticle(), _a(a)
{
}
KNScorableArticle::~KNScorableArticle()
{
}
void KNScorableArticle::addScore(short s)
{
_a->setScore(_a->score()+s);
_a->setChanged(true);
}
void KNScorableArticle::changeColor(const TQColor& c)
{
_a->setColor(c);
}
void KNScorableArticle::displayMessage(const TQString& s)
{
if (!_a->isNew()) return;
if (!notifyC) notifyC = new NotifyCollection();
notifyC->addNote(*this,s);
}
TQString KNScorableArticle::from() const
{
return _a->from()->asUnicodeString();
}
TQString KNScorableArticle::subject() const
{
return _a->subject()->asUnicodeString();
}
TQString KNScorableArticle::getHeaderByType(const TQString& s) const
{
KMime::Headers::Base *h = _a->getHeaderByType(s.latin1());
if (!h) return "";
TQString t = _a->getHeaderByType(s.latin1())->asUnicodeString();
Q_ASSERT( !t.isEmpty() );
return t;
}
void KNScorableArticle::markAsRead()
{
_a->setRead();
}
//----------------------------------------------------------------------------
KNScorableGroup::KNScorableGroup()
{
}
KNScorableGroup::~KNScorableGroup()
{
}
//----------------------------------------------------------------------------
KNScoringManager::KNScoringManager() : KScoringManager("knode")
{
}
KNScoringManager::~KNScoringManager()
{
}
TQStringList KNScoringManager::getGroups() const
{
KNAccountManager *am = knGlobals.accountManager();
TQStringList res;
TQValueList<KNNntpAccount*>::Iterator it;
for ( it = am->begin(); it != am->end(); ++it ) {
TQStringList groups;
knGlobals.groupManager()->getSubscribed( (*it), groups);
res += groups;
}
res.sort();
return res;
}
TQStringList KNScoringManager::getDefaultHeaders() const
{
TQStringList l = KScoringManager::getDefaultHeaders();
l << "Lines";
l << "References";
return l;
}
void KNScoringManager::configure()
{
KScoringEditor *dlg = KScoringEditor::createEditor(this, knGlobals.topWidget);
if (dlg) {
dlg->show();
KWin::activateWindow(dlg->winId());
}
}
#include "knscoring.moc"
|