Author: tgoettlicher
Date: Thu Jan 31 14:43:05 2008
New Revision: 44067
URL: http://svn.opensuse.org/viewcvs/yast?rev=44067&view=rev
Log:
+ kcmoduleinfo
Added:
branches/tmp/tgoettlicher/yast2cc_rewrite/src/kcmoduleinfo.cpp
branches/tmp/tgoettlicher/yast2cc_rewrite/src/kcmoduleinfo.h
Added: branches/tmp/tgoettlicher/yast2cc_rewrite/src/kcmoduleinfo.cpp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/tgoettlicher/yast2cc_rewrite/src/kcmoduleinfo.cpp?rev=44067&view=auto
==============================================================================
--- branches/tmp/tgoettlicher/yast2cc_rewrite/src/kcmoduleinfo.cpp (added)
+++ branches/tmp/tgoettlicher/yast2cc_rewrite/src/kcmoduleinfo.cpp Thu Jan 31 14:43:05 2008
@@ -0,0 +1,201 @@
+/*
+ Copyright (c) 1999 Matthias Hoelzer-Kluepfel
+ Copyright (c) 2000 Matthias Elter
+ Copyright (c) 2003 Daniel Molkentin
+ Copyright (c) 2003,2006 Matthias Kretz
+
+ This file is part of the KDE project
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License version 2, as published by the Free Software Foundation.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "kcmoduleinfo.h"
+
+#include
+
+//#include
+//#include
+//#include
+//#include
+//#include
+
+class KCModuleInfo::Private
+{
+ public:
+ Private();
+// Private( KService::Ptr );
+
+ QStringList keywords;
+ QString name, icon, lib, handle, fileName, doc, comment;
+ bool allLoaded;
+ int weight;
+
+ //KService::Ptr service;
+
+ /**
+ * Reads the service entries specific for KCModule from the desktop file.
+ * The usual desktop entries are read in the Private ctor.
+ */
+ void loadAll();
+};
+
+KCModuleInfo::Private::Private()
+{
+}
+
+/*KCModuleInfo::Private::Private( KService::Ptr s )
+ : allLoaded( false )
+ , service( s )
+{
+ if ( !service )
+ {
+ kDebug(712) << "Could not find the service.";
+ return;
+ }
+
+ // set the modules simple attributes
+ name = service->name();
+ comment = service->comment();
+ icon = service->icon();
+ fileName = service->entryPath();
+ lib = service->library();
+ keywords = service->keywords();
+}
+*/
+
+KCModuleInfo::KCModuleInfo()
+{
+ d = new Private;
+}
+
+KCModuleInfo::KCModuleInfo(const QString& desktopFile)
+{
+// d = new Private( KService::serviceByStorageId(desktopFile) );
+}
+
+//KCModuleInfo::KCModuleInfo( KService::Ptr moduleInfo )
+//{
+// d = new Private( moduleInfo );
+//}
+
+KCModuleInfo::KCModuleInfo( const KCModuleInfo &rhs )
+{
+ d = new Private;
+ ( *this ) = rhs;
+}
+
+KCModuleInfo &KCModuleInfo::operator=( const KCModuleInfo &rhs )
+{
+ *d = *(rhs.d);
+ return *this;
+}
+
+bool KCModuleInfo::operator==( const KCModuleInfo & rhs ) const
+{
+ return ( ( d->name == rhs.d->name ) && ( d->lib == rhs.d->lib ) && ( d->fileName == rhs.d->fileName ) );
+}
+
+bool KCModuleInfo::operator!=( const KCModuleInfo & rhs ) const
+{
+ return ! operator==( rhs );
+}
+
+KCModuleInfo::~KCModuleInfo()
+{
+ delete d;
+}
+
+void KCModuleInfo::Private::loadAll()
+{
+ allLoaded = true;
+
+// if( !service ) /* We have a bogus service. All get functions will return empty/zero values */
+ return;
+
+ // get the documentation path
+// doc = service->property( "X-DocPath", QVariant::String ).toString();
+// if (doc.isEmpty())
+// doc = service->property( "DocPath", QVariant::String ).toString();
+
+ // read weight
+// QVariant tmp = service->property( "X-KDE-Weight", QVariant::Int );
+// weight = tmp.isValid() ? tmp.toInt() : 100;
+
+ // factory handle
+// tmp = service->property("X-KDE-FactoryName", QVariant::String);
+// handle = tmp.isValid() ? tmp.toString() : lib;
+
+}
+
+QString KCModuleInfo::fileName() const
+{
+ return d->fileName;
+}
+
+QStringList KCModuleInfo::keywords() const
+{
+ return d->keywords;
+}
+
+QString KCModuleInfo::moduleName() const
+{
+ return d->name;
+}
+
+//KService::Ptr KCModuleInfo::service() const
+//{
+// return d->service;
+//}
+
+QString KCModuleInfo::comment() const
+{
+ return d->comment;
+}
+
+QString KCModuleInfo::icon() const
+{
+ return d->icon;
+}
+
+QString KCModuleInfo::library() const
+{
+ return d->lib;
+}
+
+QString KCModuleInfo::docPath() const
+{
+ if (!d->allLoaded)
+ d->loadAll();
+
+ return d->doc;
+}
+
+QString KCModuleInfo::handle() const
+{
+ if (!d->allLoaded)
+ d->loadAll();
+
+ return d->handle;
+}
+
+int KCModuleInfo::weight() const
+{
+ if (!d->allLoaded)
+ d->loadAll();
+
+ return d->weight;
+}
+
+// vim: ts=2 sw=2 et
Added: branches/tmp/tgoettlicher/yast2cc_rewrite/src/kcmoduleinfo.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/tgoettlicher/yast2cc_rewrite/src/kcmoduleinfo.h?rev=44067&view=auto
==============================================================================
--- branches/tmp/tgoettlicher/yast2cc_rewrite/src/kcmoduleinfo.h (added)
+++ branches/tmp/tgoettlicher/yast2cc_rewrite/src/kcmoduleinfo.h Thu Jan 31 14:43:05 2008
@@ -0,0 +1,166 @@
+/*
+ Copyright (c) 1999 Matthias Hoelzer-Kluepfel
+ Copyright (c) 2000 Matthias Elter
+ Copyright (c) 2003 Daniel Molkentin
+ Copyright (c) 2003,2006 Matthias Kretz
+
+ This file is part of the KDE project
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License version 2, as published by the Free Software Foundation.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef KCMODULEINFO_H
+#define KCMODULEINFO_H
+
+//#include
+//#include
+
+#include <QString>
+#include <QStringList>
+
+class QString;
+class QStringList;
+
+/**
+ * A class that provides information about a KCModule
+ *
+ * KCModuleInfo provides various technical information, such as icon, library
+ * etc. about a KCModule.n
+ * @note Any values set with the set* functions is not
+ * written back with KCModuleInfo it only reads value from the desktop file.
+ *
+ * @internal
+ * @author Matthias Hoelzer-Kluepfel
+ * @author Matthias Elter
+ * @author Daniel Molkentin
+ *
+ */
+class KCModuleInfo // krazy:exclude=dpointer (implicitly shared)
+{
+
+public:
+
+ /**
+ * Constructs a KCModuleInfo.
+ * @note a KCModuleInfo object will have to be manually deleted, it is not
+ * done automatically for you.
+ * @param desktopFile the desktop file representing the module, or
+ * the name of the module.
+ */
+ KCModuleInfo(const QString& desktopFile);
+
+ /**
+ * Same as above but takes a KService::Ptr as argument.
+ *
+ * @note @p moduleInfo must be a valid pointer.
+ *
+ * @param moduleInfo specifies the module
+ */
+// KCModuleInfo( KService::Ptr moduleInfo );
+
+
+ /**
+ * Same as above but takes a KCModuleInfo as argument.
+ *
+ * @param rhs specifies the module
+ */
+ KCModuleInfo( const KCModuleInfo &rhs );
+
+ /**
+ * Same as above but creates an empty KCModuleInfo.
+ * You should not normally call this.
+ */
+ KCModuleInfo();
+
+ /**
+ * Assignment operator
+ */
+ KCModuleInfo &operator=( const KCModuleInfo &rhs );
+
+ /**
+ * Returns true if @p rhs describes the same KCModule as this object.
+ */
+ bool operator==( const KCModuleInfo &rhs ) const;
+
+ /**
+ * @return true if @p rhs is not equal itself
+ */
+ bool operator!=( const KCModuleInfo &rhs ) const;
+
+ /**
+ * Default destructor.
+ */
+ ~KCModuleInfo();
+
+ /**
+ * @return the filename of the .desktop file that describes the KCM
+ */
+ QString fileName() const;
+
+ /**
+ * @return the keywords associated with this KCM.
+ */
+ QStringList keywords() const;
+
+ /**
+ * @return the module\'s (translated) name
+ */
+ QString moduleName() const;
+
+ /**
+ * @return a KSharedPtr to KService created from the modules .desktop file
+ */
+// KService::Ptr service() const;
+
+ /**
+ * @return the module's (translated) comment field
+ */
+ QString comment() const;
+
+ /**
+ * @return the module's icon name
+ */
+ QString icon() const;
+
+ /**
+ * @return the path of the module's documentation
+ */
+ QString docPath() const;
+
+ /**
+ * @return the library name
+ */
+ QString library() const;
+
+ /**
+ * @return a handle (the contents of the X-KDE-FactoryName field if it exists,
+ * else the same as the library name)
+ */
+ QString handle() const;
+
+ /**
+ * @return the weight of the module which determines the order of the pages in
+ * the KCMultiDialog. It's set by the X-KDE-Weight field.
+ */
+ int weight() const;
+
+private:
+ class Private;
+ Private * d;
+};
+
+#endif // KCMODULEINFO_H
+
+// vim: ts=2 sw=2 et
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org