Author: tgoettlicher
Date: Thu May 3 16:19:47 2007
New Revision: 5475
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5475&view=rev
Log:
backup
Modified:
branches/work/updater-kde-refactoring/updater-kde/updater/ConfigWidget.cpp
branches/work/updater-kde-refactoring/updater-kde/updater/UpdaterApplication.cpp
branches/work/updater-kde-refactoring/updater-kde/updater/UpdaterApplication.h
Modified: branches/work/updater-kde-refactoring/updater-kde/updater/ConfigWidget.cpp
URL: http://svn.opensuse.org/viewcvs/zypp/branches/work/updater-kde-refactoring/updater-kde/updater/ConfigWidget.cpp?rev=5475&r1=5474&r2=5475&view=diff
==============================================================================
--- branches/work/updater-kde-refactoring/updater-kde/updater/ConfigWidget.cpp (original)
+++ branches/work/updater-kde-refactoring/updater-kde/updater/ConfigWidget.cpp Thu May 3 16:19:47 2007
@@ -27,6 +27,8 @@
#include
#include
#include "ConfigWidget.h"
+#include
+#include
ConfigWidget::ConfigWidget(QWidget* parent, const char* name)
@@ -38,6 +40,13 @@
setName("ConfigWidget");
}
+ // following lines enable storing backendplugin name
+ // otherwise we would store the itemnumber in config combobox which is worthless
+ kapp->installKDEPropertyMap();
+ QSqlPropertyMap *map = QSqlPropertyMap::defaultMap();
+ map->insert("QComboBox", "currentText");
+
+
addBackendPlugins();
}
Modified: branches/work/updater-kde-refactoring/updater-kde/updater/UpdaterApplication.cpp
URL: http://svn.opensuse.org/viewcvs/zypp/branches/work/updater-kde-refactoring/updater-kde/updater/UpdaterApplication.cpp?rev=5475&r1=5474&r2=5475&view=diff
==============================================================================
--- branches/work/updater-kde-refactoring/updater-kde/updater/UpdaterApplication.cpp (original)
+++ branches/work/updater-kde-refactoring/updater-kde/updater/UpdaterApplication.cpp Thu May 3 16:19:47 2007
@@ -35,95 +35,100 @@
, _main(0L), _updater(0L)
{
- loadPlugins();
-// QString backend = UpdaterSettings::self()->backendPlugin();
-// QString backend = UpdaterSettings::self()->backendPlugin();
-
- kdDebug() << "BACKEND:" << endl;
- kdDebug() << UpdaterSettings::self()->backendPlugin() << endl;;
- kdDebug() << "BACKEND" << endl;
-
+ selectPlugin();
-// if ( backend == UpdaterSettings::EnumBackend::zmd )
-// {
-// kdDebug() << "Using ZMD backend..." << endl;
-// updater = new ZmdUpdater();
-// }
-// else if ( backend == UpdaterSettings::EnumBackend::zypp )
-// {
-// kdDebug() << "Using ZYPP backend..." << endl;
-// updater = new ZYppUpdater();
-// }
-// else
-// {
-// kdDebug() << "No backend selected. Using ZYPP backend..." << endl;
-// updater = new ZYppUpdater();
-// kdDebug() << "backend initialized" << endl;
-// }
-
- //main = new MainWindow(updater->capabilities());
_main = new MainWindow(UpdaterCapabilities());
setMainWidget(_main);
- setupUpdater(_updater);
+ if (_updater != NULL )
+ setupUpdater(_updater);
_main->checkUpdates();
}
-void UpdaterApplication::loadPlugins()
+bool UpdaterApplication::loadPlugin(KService::Ptr service)
{
+ int errCode = 0;
- kdDebug() << "Searching for plugins ..." << endl;
+ Updater* plugin = KParts::ComponentFactory::createInstanceFromService<Updater> ( service, 0, 0, QStringList(), &errCode);
+ if (plugin && errCode == 0 )
+ {
+ _updater = plugin;
+ kdDebug() << "Backend plugin \"" << service->name() << "\" loaded." << endl;
+ return true;
+ }
+ else
+ {
+ switch (errCode)
+ {
+ case KParts::ComponentFactory::ErrNoServiceFound :
+ kdDebug() << "Unable to load plugin. ErrNoServiceFound" << endl;
+ break;
+
+ case KParts::ComponentFactory::ErrServiceProvidesNoLibrary :
+ kdDebug() << "Unable to load plugin. ErrServiceProvidesNoLibrary" << endl;
+ break;
+
+ case KParts::ComponentFactory::ErrNoLibrary :
+ kdDebug() << "Unable to load plugin. ErrNoLibrary: " << KLibLoader::self()->lastErrorMessage() << endl;
+ break;
+
+ case KParts::ComponentFactory::ErrNoFactory :
+ kdDebug() << "Unable to load plugin. ErrNoFactory" << endl;
+ break;
+
+ case KParts::ComponentFactory::ErrNoComponent :
+ kdDebug() << "Unable to load plugin. ErrNoComponent" << endl;
+ break;
+
+ default:
+ kdDebug() << "Unable to load plugin. Unknown Error" << errCode << endl;
+ break;
+ }
+ return false;
+ }
+}
- KTrader::OfferList offers = KTrader::self()->query("openSUSEUpdater/Backend");
+
+void UpdaterApplication::selectPlugin()
+{
+
+ QString backend = UpdaterSettings::self()->backendPlugin();
+
+ kdDebug() << "Searching for desired backend plugin \"" << backend << "\" ..." << endl;
+
+ KTrader::OfferList offers = KTrader::self()->query("openSUSEUpdater/Backend");
KTrader::OfferList::ConstIterator iter;
+
+ bool pluginFound = false;
+
for(iter = offers.begin(); iter != offers.end(); ++iter )
{
KService::Ptr service = *iter;
- kdDebug() << "Found plugin: " << service->name() << endl;
- if (service->name() == "ZYpp backend")
-// if (service->name() == "Dummy backend")
+ kdDebug() << "Found backend plugin \"" << service->name() << "\"" << endl;
+ if (service->name() == backend)
{
- int errCode = 0;
- Updater* plugin = KParts::ComponentFactory::createInstanceFromService<Updater> ( service, 0, 0, QStringList(), &errCode);
-
- if (plugin && errCode == 0 )
- {
- _updater = plugin;
- kdDebug() << "Loaded plugin " << service->name() << endl;
- }
- else
- {
- switch (errCode)
- {
- case KParts::ComponentFactory::ErrNoServiceFound :
- kdDebug() << "Unable to load plugin. ErrNoServiceFound" << endl;
- break;
-
- case KParts::ComponentFactory::ErrServiceProvidesNoLibrary :
- kdDebug() << "Unable to load plugin. ErrServiceProvidesNoLibrary" << endl;
- break;
-
- case KParts::ComponentFactory::ErrNoLibrary :
- kdDebug() << "Unable to load plugin. ErrNoLibrary: " << KLibLoader::self()->lastErrorMessage() << endl;
- break;
-
- case KParts::ComponentFactory::ErrNoFactory :
- kdDebug() << "Unable to load plugin. ErrNoFactory" << endl;
- break;
-
- case KParts::ComponentFactory::ErrNoComponent :
- kdDebug() << "Unable to load plugin. ErrNoComponent" << endl;
- break;
-
- default:
- kdDebug() << "Unable to load plugin. Unknown Error" << errCode << endl;
- break;
- }
- }
+ kdDebug() << "Trying to load backend plugin \"" << service->name() << "\"." << endl;
+ loadPlugin(service);
+ pluginFound = true;
}
}
+ if (!pluginFound)
+ {
+ kdDebug() << "please change backend configuration." << endl;
+
+ // Our configuration data contains no available backend plugin
+ // therefor we preselect the fist available backend plugin
+ // because kcfg would overwrite this item at the config dialog
+
+ iter = offers.begin();
+ if (iter != offers.end())
+ {
+ KService::Ptr service = *iter;
+ UpdaterSettings::setBackendPlugin(service->name());
+ }
+ }
}
void UpdaterApplication::setupUpdater( Updater *updater )
Modified: branches/work/updater-kde-refactoring/updater-kde/updater/UpdaterApplication.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/work/updater-kde-refactoring/updater-kde/updater/UpdaterApplication.h?rev=5475&r1=5474&r2=5475&view=diff
==============================================================================
--- branches/work/updater-kde-refactoring/updater-kde/updater/UpdaterApplication.h (original)
+++ branches/work/updater-kde-refactoring/updater-kde/updater/UpdaterApplication.h Thu May 3 16:19:47 2007
@@ -21,6 +21,8 @@
#define _UPDATER_APPLICATION_H_
#include
+#include
+
class MainWindow;
class Updater;
@@ -36,7 +38,7 @@
/**
This class represents the actual app, it inits the applet, loads the mainWindow
- and connects the GUI with the currently selected backend. It has no methods.
+ and connects the GUI with the currently selected backend.
*/
class UpdaterApplication : public KUniqueApplication {
@@ -45,7 +47,6 @@
UpdaterApplication();
~UpdaterApplication();
- void loadPlugins();
void setupUpdater( Updater *updater );
signals:
void shutdown();
@@ -53,6 +54,8 @@
MainWindow *_main;
Updater *_updater;
+ bool loadPlugin(KService::Ptr service);
+ void selectPlugin();
};
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org