[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdevelop/plugins/appwizard
From: Evgeniy Ivanov <pfx.kde () gmail ! com>
Date: 2008-08-09 16:13:27
Message-ID: 1218298407.660451.14192.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 844403 by eivanov:
Some refactoring
M +20 -25 appwizardplugin.cpp
M +4 -1 appwizardplugin.h
--- trunk/KDE/kdevelop/plugins/appwizard/appwizardplugin.cpp #844402:844403
@@ -175,9 +175,8 @@
if ( !unpackArchive( arch->directory(), unpackDir ) )
{
- KMessageBox::error(0, i18n("Could not create new project"));
- KIO::NetAccess::del( KUrl( unpackDir ), 0 );
- return "";
+ QString errorMsg = i18n("Could not create new project");
+ return vcsError(errorMsg, tmpdir, KUrl(unpackDir));
}
if( !info.vcsPluginName.isEmpty() && plugin )
@@ -193,10 +192,8 @@
KDevelop::VcsJob* job = iface->init(dest.toLocalFile());
if (!job || !job->exec() || job->status() != KDevelop::VcsJob::JobSucceeded)
{
- KMessageBox::error(0, i18n("Could not initialize DVCS repository"));
- KIO::NetAccess::del( dest, 0);
- tmpdir.unlink();
- return "";
+ QString errorMsg = i18n("Could not initialize DVCS repository");
+ return vcsError(errorMsg, tmpdir, dest);
}
kDebug(9010) << "Initializing DVCS repository:" << dest.toLocalFile();
@@ -204,19 +201,15 @@
KDevelop::IBasicVersionControl::Recursive);
if (!job || !job->exec() || job->status() != KDevelop::VcsJob::JobSucceeded)
{
- KMessageBox::error(0, i18n("Could not add files to the DVCS repository"));
- KIO::NetAccess::del( dest, 0);
- tmpdir.unlink();
- return "";
+ QString errorMsg = i18n("Could not add files to the DVCS repository");
+ return vcsError(errorMsg, tmpdir, dest);
}
- job = iface->commit(QString("Initial commit from KDevelop"), KUrl::List(dest),
+ job = iface->commit(QString("initial project import from KDevelop"), KUrl::List(dest),
KDevelop::IBasicVersionControl::Recursive);
if (!job || !job->exec() || job->status() != KDevelop::VcsJob::JobSucceeded)
{
- KMessageBox::error(0, i18n("Could not make an initial commit"));
- KIO::NetAccess::del( dest, 0);
- tmpdir.unlink();
- return "";
+ QString errorMsg = i18n("Could not make an initial commit to");
+ return vcsError(errorMsg, tmpdir, dest);
}
}
else
@@ -239,18 +232,14 @@
KDevelop::VcsJob* job = iface->checkout( info.checkoutInformation );
if (!job || !job->exec() || job->status() != KDevelop::VcsJob::JobSucceeded )
{
- KMessageBox::error(0, i18n("Could not checkout imported project"));
- KIO::NetAccess::del( dest, 0 );
- tmpdir.unlink();
- return "";
+ QString errorMsg = i18n("Could not checkout imported project");
+ return vcsError(errorMsg, tmpdir, dest);
}
}
else
{
- KMessageBox::error(0, i18n("Could not import project"));
- KIO::NetAccess::del( dest, 0 );
- tmpdir.unlink();
- return "";
+ QString errorMsg = i18n("Could not import project");
+ return vcsError(errorMsg, tmpdir, dest);
}
}
}
@@ -362,6 +351,12 @@
}
}
+QString AppWizardPlugin::vcsError(const QString &errorMsg, KTempDir &tmpdir, const KUrl &dest)
+{
+ KMessageBox::error(0, errorMsg);
+ KIO::NetAccess::del(dest, 0);
+ tmpdir.unlink();
+ return "";
+}
#include "appwizardplugin.moc"
-
--- trunk/KDE/kdevelop/plugins/appwizard/appwizardplugin.h #844402:844403
@@ -18,8 +18,10 @@
#include <QVariant>
class ProjectTemplatesModel;
+class ApplicationInfo;
class KArchiveDirectory;
-class ApplicationInfo;
+class KTempDir;
+class KUrl;
class AppWizardPlugin: public KDevelop::IPlugin {
Q_OBJECT
@@ -35,6 +37,7 @@
QString createProject(const ApplicationInfo& );
bool unpackArchive(const KArchiveDirectory *dir, const QString &dest);
bool copyFileAndExpandMacros(const QString &source, const QString &dest);
+ QString vcsError(const QString &errorMsg, KTempDir &tmpdir, const KUrl &dest);
ProjectTemplatesModel *m_templatesModel;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic