[yast-commit] r54302 - in /branches/tmp/tgoettlicher/yast2cc_rewrite/src: CMakeLists.txt yccmoduleinfoprovider.cpp yccmoduleinfoprovider.h yqmodulesmodel.cpp
Author: dmacvicar
Date: Fri Dec 19 16:17:32 2008
New Revision: 54302
URL: http://svn.opensuse.org/viewcvs/yast?rev=54302&view=rev
Log:
Implements Stano's idea of status in the modules, using the easier
yast2 external call while core get's stano's patch
Added:
branches/tmp/tgoettlicher/yast2cc_rewrite/src/yccmoduleinfoprovider.cpp
branches/tmp/tgoettlicher/yast2cc_rewrite/src/yccmoduleinfoprovider.h
Modified:
branches/tmp/tgoettlicher/yast2cc_rewrite/src/CMakeLists.txt
branches/tmp/tgoettlicher/yast2cc_rewrite/src/yqmodulesmodel.cpp
Modified: branches/tmp/tgoettlicher/yast2cc_rewrite/src/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/tgoettlicher/yast2cc_rewrite/src/CMakeLists.txt?rev=54302&r1=54301&r2=54302&view=diff
==============================================================================
--- branches/tmp/tgoettlicher/yast2cc_rewrite/src/CMakeLists.txt (original)
+++ branches/tmp/tgoettlicher/yast2cc_rewrite/src/CMakeLists.txt Fri Dec 19 16:17:32 2008
@@ -22,6 +22,8 @@
# moduleiconitem.cpp
# kcmoduleinfo.cpp
+ yccmoduleinfoprovider.cpp
+
yqdesktopfilesmodel.cpp
yqmodulegroupsmodel.cpp
yqmodulesmodel.cpp
@@ -42,7 +44,9 @@
# moduleiconitem.h
# kcmoduleinfo.h
kcategorizedview_p.h
-
+
+ yccmoduleinfoprovider.h
+
yqdesktopfilesmodel.h
yqmodulegroupsmodel.h
yqmodulesmodel.h
@@ -69,6 +73,7 @@
models_test.cpp
yqdesktopfilesmodel.cpp
yqmodulegroupsmodel.cpp
+ yccmoduleinfoprovider.cpp
yqmodulesmodel.cpp )
Added: branches/tmp/tgoettlicher/yast2cc_rewrite/src/yccmoduleinfoprovider.cpp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/tgoettlicher/yast2cc_rewrite/src/yccmoduleinfoprovider.cpp?rev=54302&view=auto
==============================================================================
--- branches/tmp/tgoettlicher/yast2cc_rewrite/src/yccmoduleinfoprovider.cpp (added)
+++ branches/tmp/tgoettlicher/yast2cc_rewrite/src/yccmoduleinfoprovider.cpp Fri Dec 19 16:17:32 2008
@@ -0,0 +1,84 @@
+
+#include <QTemporaryFile>
+#include <QProcess>
+#include <QDebug>
+
+#include "yccmoduleinfoprovider.h"
+
+YCCModuleInfoProvider::YCCModuleInfoProvider()
+{
+}
+
+YCCModuleInfoProvider::~YCCModuleInfoProvider()
+{
+}
+
+//if defined $X-SuSE-YaST-AutoInst && $X-SuSE-YaST-AutoInst != none
+// X-SuSE-YaST-AutoInst=all
+QString YCCModuleInfoProvider::provideInfo( const YQModulesModel *model, const QModelIndex &module ) const
+{
+///sbin/yast2 get_status foo_auto /tmp/status
+ QString ret;
+
+ QString autoinst = model->propertyValue( module, "X-SuSE-YaST-AutoInst" ).toString();
+ if ( ! autoinst.isEmpty() && ( autoinst != "none" ) )
+ {
+ //QTemporaryFile file;
+
+ //if ( ! file.open() )
+ //{
+ // qDebug() << "Can't create temporary file";
+ // return QString();
+ //}
+
+ QStringList arguments;
+ QString modcall = model->propertyValue( module, "X-SuSE-YaST-Call" ).toString();
+ if ( ! modcall.isEmpty() )
+ {
+ QProcess yast2;
+ QString autoinstclient = model->propertyValue( module, "X-SuSE-YaST-AutoInstClient" ).toString();
+ if ( autoinstclient.isEmpty() )
+ {
+ autoinstclient = modcall + "_auto";
+ }
+
+ QStringList args;
+ //args << (autoinstclient) << file.fileName();
+ args << "get_status" << (autoinstclient) << "/tmp/ycc_status";
+ qDebug() << "Executing yast2 " << args;
+
+ yast2.start("/sbin/yast2", args );
+
+ if ( ! yast2.waitForFinished() )
+ {
+ qDebug() << "bad yast2 exit";
+ return QString();
+ }
+
+ //QFile data(file.fileName());
+ QFile data("/tmp/ycc_status");
+ if ( data.open( QIODevice::ReadOnly ) )
+ {
+ QTextStream in(&data);
+ while (!in.atEnd())
+ {
+ QString line = in.readLine();
+ ret += line;
+ }
+ }
+ else
+ qDebug() << "can't read from temporary file" << ret;
+ }
+ else
+ {
+ qDebug() << "no info to call";
+ }
+
+ }
+ else
+ {
+ qDebug() << "no info to call";
+ }
+ return ret;
+}
+
Added: branches/tmp/tgoettlicher/yast2cc_rewrite/src/yccmoduleinfoprovider.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/tgoettlicher/yast2cc_rewrite/src/yccmoduleinfoprovider.h?rev=54302&view=auto
==============================================================================
--- branches/tmp/tgoettlicher/yast2cc_rewrite/src/yccmoduleinfoprovider.h (added)
+++ branches/tmp/tgoettlicher/yast2cc_rewrite/src/yccmoduleinfoprovider.h Fri Dec 19 16:17:32 2008
@@ -0,0 +1,18 @@
+
+#ifndef YCCModuleInfoProvider_H
+#define YCCModuleInfoProvider_H
+
+#include "yqmodulesmodel.h"
+
+class YCCModuleInfoProvider
+{
+public:
+ YCCModuleInfoProvider();
+ ~YCCModuleInfoProvider();
+
+ QString provideInfo( const YQModulesModel *model, const QModelIndex &module ) const;
+
+private:
+};
+
+#endif
Modified: branches/tmp/tgoettlicher/yast2cc_rewrite/src/yqmodulesmodel.cpp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/tgoettlicher/yast2cc_rewrite/src/yqmodulesmodel.cpp?rev=54302&r1=54301&r2=54302&view=diff
==============================================================================
--- branches/tmp/tgoettlicher/yast2cc_rewrite/src/yqmodulesmodel.cpp (original)
+++ branches/tmp/tgoettlicher/yast2cc_rewrite/src/yqmodulesmodel.cpp Fri Dec 19 16:17:32 2008
@@ -15,6 +15,7 @@
#include "yqmodulesproxymodel.h"
#include "yqmodulegroupsmodel.h"
+#include "yccmoduleinfoprovider.h"
class YQModulesModel::Private
{
@@ -33,6 +34,7 @@
YQModuleGroupsModel *groupsModel;
QMap
participants (1)
-
dmacvicar@svn.opensuse.org