[SCM] Kaboom - Debian KDE 3->4 migration tool branch, master, updated. 87446012f77962a6bf454b39b94362cb64613dcb
Modestas Vainius
modax-guest at alioth.debian.org
Sun Mar 1 08:58:51 UTC 2009
The following commit has been merged in the master branch:
commit fb75169b49b0a0ed911b21c27eedfdcbf6dc89f1
Author: Modestas Vainius <modestas at vainius.eu>
Date: Sun Mar 1 02:00:34 2009 +0200
Port existing code to use KaboomSettings instead of hardcoded KDEDIR vars
Signed-off-by: Modestas Vainius <modestas at vainius.eu>
diff --git a/choicepage.cpp b/choicepage.cpp
index ca1372a..51eec4b 100644
--- a/choicepage.cpp
+++ b/choicepage.cpp
@@ -18,6 +18,7 @@
#include "diroperations/diroperations.h"
#include "richradiobutton.h"
#include "diroperations/progresswidget.h"
+#include "kaboomsettings.h"
class ChoicePagePrivate
{
@@ -34,8 +35,6 @@ class ChoicePagePrivate
QProgressBar *spacebar;
ProgressWidget *progresswidget;
QLabel *freeinfo;
- bool haskde4dir;
- bool haskdedir;
};
ChoicePage::ChoicePage(QWidget *parent) : QWizardPage(parent)
@@ -43,25 +42,23 @@ ChoicePage::ChoicePage(QWidget *parent) : QWizardPage(parent)
d = new ChoicePagePrivate;
QVBoxLayout *lay = new QVBoxLayout(this);
setTitle(tr("Kaboom - Migration Tool"));
- d->haskde4dir = QFile::exists(QDir::homePath()+KDE4DIR);
- d->haskdedir = QFile::exists(QDir::homePath()+KDEDIR);
d->buttons = new QButtonGroup(this);
d->text = new QLabel(tr("Please select your settings migration option"),this);
d->text->setWordWrap(true);
lay->addWidget(d->text);
- if(d->haskdedir)
+ if(KaboomSettings::instance().kdehomeDir().exists())
{
d->migrate = new RichRadioButton(tr("Migrate settings from KDE3 to KDE4 (standard)"),this);
d->buttons->addButton(d->migrate,MigrationTool::Migrate);
lay->addWidget(d->migrate);
d->migrate->setChecked(true);
}
- if(d->haskde4dir)
+ if(KaboomSettings::instance().kde4homeDir().exists())
{
d->move = new RichRadioButton(tr("Use existing KDE 4 settings and <b>replace</b> KDE 3 settings"));
d->buttons->addButton(d->move,MigrationTool::Move);
lay->addWidget(d->move);
- if(d->haskdedir)
+ if(KaboomSettings::instance().kdehomeDir().exists())
{
d->merge = new RichRadioButton(tr("Merge settings from KDE3 and KDE4 (experimental)"));
d->buttons->addButton(d->merge,MigrationTool::Merge);
@@ -83,7 +80,7 @@ ChoicePage::ChoicePage(QWidget *parent) : QWizardPage(parent)
lay->addWidget(d->backup);
d->backup->hide();
d->backup->setChecked(false);
- if(d->haskdedir) //if no kdedir, nothing to backup.
+ if(KaboomSettings::instance().kdehomeDir().exists()) //if no kdedir, nothing to backup.
{
d->backupinformation = new QWidget(this);
QVBoxLayout *blay = new QVBoxLayout(d->backupinformation);
diff --git a/main.cpp b/main.cpp
index a0166c8..6ee8f97 100644
--- a/main.cpp
+++ b/main.cpp
@@ -15,19 +15,22 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "migrationtool.h"
+#include "kaboomsettings.h"
#include <QApplication>
#include <QFile>
#include <QTranslator>
int main(int argc, char* argv[])
{
- if(QFile::exists(QDir::homePath()+"/.local/kdebian3to4"))
+ KaboomSettings settings(argc, argv);
+
+ if(settings.stampExists())
{
return 0;
}
- if(!QFile::exists(QDir::homePath()+KDEDIR) && !QFile::exists(QDir::homePath()+KDE4DIR))
+ if(!settings.kdehomeDir().exists() && !settings.kde4homeDir().exists())
{
- QFile(QDir::homePath()+"/.local/kdebian3to4").open(QIODevice::WriteOnly);
+ settings.touchStamp();
return 0;
}
diff --git a/migrationpage.cpp b/migrationpage.cpp
index 4b5200e..a55ced7 100644
--- a/migrationpage.cpp
+++ b/migrationpage.cpp
@@ -18,6 +18,7 @@
#include "choicepage.h"
#include "migrationpage_p.h"
#include "diroperations/diroperations.h"
+#include "kaboomsettings.h"
MigrationPagePrivate::MigrationPagePrivate(MigrationPage* parent)
@@ -42,12 +43,13 @@ void MigrationPagePrivate::doMagic()
q->setTitle(tr("Migration running"));
if(backup)
{
- if(QFile::exists(QDir::homePath()+KDEDIR))
+ if(KaboomSettings::instance().kdehomeDir().exists())
{
try
{
- DirOperations::recursiveCpDir(QDir::homePath()+KDEDIR,QDir::homePath()+KDE3BACKUPDIR,
- DirOperations::RemoveDestination,progress);
+ DirOperations::recursiveCpDir(KaboomSettings::instance().kdehomeDir().canonicalPath(),
+ KaboomSettings::instance().kde3backupDir().canonicalPath(),
+ DirOperations::RemoveDestination, progress);
}
catch (DirOperations::Exception &e)
{
@@ -68,16 +70,18 @@ void MigrationPagePrivate::doMagic()
qDebug() << "do nothing, let kconf_update do magic";
break;
case MigrationTool::Merge:
- DirOperations::recursiveCpDir(QDir::homePath()+KDE4DIR,QDir::homePath()+KDEDIR,
+ DirOperations::recursiveCpDir(KaboomSettings::instance().kde4homeDir().canonicalPath(),
+ KaboomSettings::instance().kdehomeDir().canonicalPath(),
DirOperations::OverWrite,progress);
qDebug() << "do magic experimental merge";
break;
case MigrationTool::Clean:
qDebug() << "do recursive rm of .kde dir";
- DirOperations::recursiveRmDir(QDir::homePath()+KDEDIR,progress);
+ DirOperations::recursiveRmDir(KaboomSettings::instance().kdehomeDir().canonicalPath(), progress);
break;
case MigrationTool::Move:
- DirOperations::recursiveCpDir(QDir::homePath()+KDE4DIR,QDir::homePath()+KDEDIR,
+ DirOperations::recursiveCpDir(KaboomSettings::instance().kde4homeDir().canonicalPath(),
+ KaboomSettings::instance().kdehomeDir().canonicalPath(),
DirOperations::RemoveDestination, progress);
qDebug() << "move .kde4 over .kde";
break;
diff --git a/migrationtool.cpp b/migrationtool.cpp
index 9db1a19..efa00e6 100644
--- a/migrationtool.cpp
+++ b/migrationtool.cpp
@@ -17,7 +17,7 @@
#include "migrationtool.h"
#include "migrationtool_p.h"
-
+#include "kaboomsettings.h"
MigrationToolPrivate::MigrationToolPrivate(MigrationTool* parent ) : QObject(parent)
{
@@ -59,7 +59,9 @@ int MigrationTool::nextId() const
return Choice;
break;
case Choice:
- if(!d->choice->backupSelected() && (d->choice->selected()==Clean||d->choice->selected()==Merge) && QFile::exists(QDir::homePath()+KDEDIR))
+ if(!d->choice->backupSelected() &&
+ (d->choice->selected()==Clean||d->choice->selected()==Merge) &&
+ KaboomSettings::instance().kdehomeDir().exists())
{
return Warning;
}
diff --git a/migrationtool.h b/migrationtool.h
index ca3dfe6..356e20d 100644
--- a/migrationtool.h
+++ b/migrationtool.h
@@ -17,9 +17,6 @@
#include <QtGui>
#ifndef MIGRATIONTOOL_H
#define MIGRATIONTOOL_H
-#define KDE4DIR "/tmp/dirstructure/kde4"
-#define KDEDIR "/tmp/dirstructure/kde"
-#define KDE3BACKUPDIR "/tmp/dirstructure/kde3-backup"
class MigrationToolPrivate;
class MigrationTool : public QWizard
@@ -46,4 +43,4 @@ class MigrationTool : public QWizard
};
-#endif // MAINWINDOW_
+#endif // MIGRATIONTOOL_H
--
Kaboom - Debian KDE 3->4 migration tool
More information about the pkg-kde-commits
mailing list