[Knode-devel] kdepim
Volker Krause
volker.krause at rwth-aachen.de
Wed Dec 24 12:48:32 CET 2003
CVS commit by vkrause:
Improve my last commit:
- Save the scorefile name instead of looking it up again
- Remove the appname parameter from save() and load() again
Proposed and reviewed by Ingo Kloecker.
M +1 -1 knode/knmainwidget.cpp 1.16
M +10 -15 libkdenetwork/kscoring.cpp 1.44
M +5 -2 libkdenetwork/kscoring.h 1.23
--- kdepim/knode/knmainwidget.cpp #1.15:1.16
@@ -976,5 +976,5 @@ void KNMainWidget::prepareShutdown()
f_ilManager->prepareShutdown();
a_ccManager->prepareShutdown();
- s_coreManager->save("knode");
+ s_coreManager->save();
}
--- kdepim/libkdenetwork/kscoring.cpp #1.43:1.44
@@ -740,6 +740,11 @@ KScoringManager::KScoringManager(const Q
{
allRules.setAutoDelete(true);
+ // determine filename of the scorefile
+ if(appName.isEmpty())
+ mFilename = KGlobal::dirs()->saveLocation("appdata") + "/scorefile";
+ else
+ mFilename = KGlobal::dirs()->saveLocation("data") + "/" + appName + "/scorefile";
// open the score file
- load(appName);
+ load();
}
@@ -749,13 +754,8 @@ KScoringManager::~KScoringManager()
}
-void KScoringManager::load(const QString& appName)
+void KScoringManager::load()
{
QDomDocument sdoc("Scorefile");
- QString filename;
- if(appName.isNull())
- filename = KGlobal::dirs()->saveLocation("appdata") + "/scorefile";
- else
- filename = KGlobal::dirs()->saveLocation("data") + "/" + appName + "/scorefile";
- QFile f( filename );
+ QFile f( mFilename );
if ( !f.open( IO_ReadOnly ) )
return;
@@ -773,13 +773,8 @@ void KScoringManager::load(const QString
}
-void KScoringManager::save(const QString& appName)
+void KScoringManager::save()
{
kdDebug(5100) << "KScoringManager::save() starts" << endl;
- QString filename;
- if(appName.isNull())
- filename = KGlobal::dirs()->saveLocation("appdata") + "/scorefile";
- else
- filename = KGlobal::dirs()->saveLocation("data") + "/" + appName + "/scorefile";
- QFile f( filename );
+ QFile f( mFilename );
if ( !f.open( IO_WriteOnly ) )
return;
--- kdepim/libkdenetwork/kscoring.h #1.22:1.23
@@ -347,6 +347,6 @@ class KScoringManager : public QObject
void initCache(const QString& group/*, const QString& server*/);
- void load(const QString& appName = QString::null);
- void save(const QString& appName = QString::null);
+ void load();
+ void save();
//--------------- Properties
@@ -382,4 +382,7 @@ class KScoringManager : public QObject
//ScorableServer* _s;
+
+ // filename of the scorefile
+ QString mFilename;
};
More information about the Knode-devel
mailing list