diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 460c52653ab0dcca6f19a4f492ed2c5e4e963ab0 (patch) | |
tree | 67208f7c145782a7e90b123b982ca78d88cc2c87 /knode/knscoring.cpp | |
download | tdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.tar.gz tdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'knode/knscoring.cpp')
-rw-r--r-- | knode/knscoring.cpp | 142 |
1 files changed, 142 insertions, 0 deletions
diff --git a/knode/knscoring.cpp b/knode/knscoring.cpp new file mode 100644 index 000000000..cad44fc81 --- /dev/null +++ b/knode/knscoring.cpp @@ -0,0 +1,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 <qstring.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 QColor& c) +{ + _a->setColor(c); +} + +void KNScorableArticle::displayMessage(const QString& s) +{ + if (!_a->isNew()) return; + if (!notifyC) notifyC = new NotifyCollection(); + notifyC->addNote(*this,s); +} + +QString KNScorableArticle::from() const +{ + return _a->from()->asUnicodeString(); +} + + +QString KNScorableArticle::subject() const +{ + return _a->subject()->asUnicodeString(); +} + + +QString KNScorableArticle::getHeaderByType(const QString& s) const +{ + KMime::Headers::Base *h = _a->getHeaderByType(s.latin1()); + if (!h) return ""; + QString 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() +{ +} + + +QStringList KNScoringManager::getGroups() const +{ + KNAccountManager *am = knGlobals.accountManager(); + QStringList res; + QValueList<KNNntpAccount*>::Iterator it; + for ( it = am->begin(); it != am->end(); ++it ) { + QStringList groups; + knGlobals.groupManager()->getSubscribed( (*it), groups); + res += groups; + } + res.sort(); + return res; +} + + +QStringList KNScoringManager::getDefaultHeaders() const +{ + QStringList 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" |