Author: kmachalkova Date: Thu Jun 4 17:00:46 2009 New Revision: 57451 URL: http://svn.opensuse.org/viewcvs/yast?rev=57451&view=rev Log: Launch modules on double-click Modified: branches/tmp/tgoettlicher/yast2cc_rewrite/src/main_window.cpp branches/tmp/tgoettlicher/yast2cc_rewrite/src/main_window.h Modified: branches/tmp/tgoettlicher/yast2cc_rewrite/src/main_window.cpp URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/tgoettlicher/yast2cc_rewrite/src/main_window.cpp?rev=57451&r1=57450&r2=57451&view=diff ============================================================================== --- branches/tmp/tgoettlicher/yast2cc_rewrite/src/main_window.cpp (original) +++ branches/tmp/tgoettlicher/yast2cc_rewrite/src/main_window.cpp Thu Jun 4 17:00:46 2009 @@ -10,6 +10,7 @@ \---------------------------------------------------------------------*/ #include "main_window.h" +#include "i18n.h" #include <QLayout> #include <QLabel> @@ -97,7 +98,7 @@ QHBoxLayout *searchLayout = new QHBoxLayout(); QLabel *searchLabel = new QLabel(); - searchLabel->setText("Search:"); + searchLabel->setText( _("Search") ); searchLayout->addWidget(searchLabel); QLineEdit *searchField = new QLineEdit(); searchLayout->addWidget(searchField); @@ -119,6 +120,9 @@ connect( d->modview, SIGNAL( pressed( const QModelIndex & ) ), SLOT( slotModulePressed( const QModelIndex & ) ) ); + + connect( d->modview, SIGNAL( doubleClicked( const QModelIndex & ) ), + SLOT( slotLaunchModule( const QModelIndex & ) ) ); } void MainWindow::slotGroupPressed( const QModelIndex &index ) @@ -148,6 +152,33 @@ } +void MainWindow::slotLaunchModule( const QModelIndex &index) +{ + QModelIndex i1 = d->modmodel->index( d->kcsfpm->mapToSource( index ).row(), YQDesktopFilesModel::Call ); + QModelIndex i2 = d->modmodel->index( d->kcsfpm->mapToSource( index ).row(), YQDesktopFilesModel::Argument ); + + if ( !i1.isValid() || !i2.isValid()) + return; + + QString client = d->modmodel->data( i1, Qt::UserRole ).toString(); + QString argument = d->modmodel->data( i2, Qt::UserRole ).toString(); + + QString cmd = QString("/sbin/yast2 "); + cmd += client; + + if (!argument.isEmpty() ) + { + cmd +=" '"; + cmd += argument; + cmd +="'"; + } + cmd += " &"; + + qDebug() << "Run command: " << cmd.toAscii(); + + system( cmd.toAscii() ); +} + void MainWindow::readSettings() { QSettings settings(APP_NAME); Modified: branches/tmp/tgoettlicher/yast2cc_rewrite/src/main_window.h URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/tgoettlicher/yast2cc_rewrite/src/main_window.h?rev=57451&r1=57450&r2=57451&view=diff ============================================================================== --- branches/tmp/tgoettlicher/yast2cc_rewrite/src/main_window.h (original) +++ branches/tmp/tgoettlicher/yast2cc_rewrite/src/main_window.h Thu Jun 4 17:00:46 2009 @@ -36,6 +36,7 @@ protected slots: void slotGroupPressed( const QModelIndex &index ); void slotModulePressed( const QModelIndex &index ); + void slotLaunchModule( const QModelIndex &index ); protected: void initActions(); void closeEvent( QCloseEvent *event); -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org