author | ar <ar> | 2004-02-21 16:02:01 (UTC) |
---|---|---|
committer | ar <ar> | 2004-02-21 16:02:01 (UTC) |
commit | db2afda83e495bff9fc19fa14a30072f1cd4c67a (patch) (side-by-side diff) | |
tree | 0281ec10dad24d83179283370661ae9225016de0 /noncore/settings | |
parent | 460258f203be746ff79e14f32a823f381b8ea513 (diff) | |
download | opie-db2afda83e495bff9fc19fa14a30072f1cd4c67a.zip opie-db2afda83e495bff9fc19fa14a30072f1cd4c67a.tar.gz opie-db2afda83e495bff9fc19fa14a30072f1cd4c67a.tar.bz2 |
improve support for BigScreen
-rw-r--r-- | noncore/settings/appearance2/appearance.cpp | 162 | ||||
-rw-r--r-- | noncore/settings/appearance2/stylelistitem.h | 8 | ||||
-rw-r--r-- | noncore/settings/aqpkg/categoryfilterimpl.cpp | 20 | ||||
-rw-r--r-- | noncore/settings/aqpkg/instoptionsimpl.cpp | 16 | ||||
-rw-r--r-- | noncore/settings/aqpkg/mainwin.cpp | 38 | ||||
-rw-r--r-- | noncore/settings/aqpkg/settingsimpl.cpp | 35 | ||||
-rw-r--r-- | noncore/settings/backup/backuprestore.cpp | 17 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/devices.cpp | 25 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/edit.cpp | 233 | ||||
-rw-r--r-- | noncore/settings/sysinfo/modulesinfo.cpp | 16 | ||||
-rw-r--r-- | noncore/settings/sysinfo/processinfo.cpp | 14 | ||||
-rw-r--r-- | noncore/settings/usermanager/userdialog.cpp | 149 |
12 files changed, 462 insertions, 271 deletions
diff --git a/noncore/settings/appearance2/appearance.cpp b/noncore/settings/appearance2/appearance.cpp index 9e5eede..ba12e55 100644 --- a/noncore/settings/appearance2/appearance.cpp +++ b/noncore/settings/appearance2/appearance.cpp @@ -28,4 +28,28 @@ */ +#include "appearance.h" +#include "editScheme.h" +#include "stylelistitem.h" +#include "decolistitem.h" +#include "colorlistitem.h" +#include "exceptlistitem.h" +#include "sample.h" + +/* OPIE */ +#include <opie/ofontselector.h> +#include <opie/odevice.h> +#include <opie/ofiledialog.h> +#include <opie/otabwidget.h> + +#include <qpe/config.h> +#include <qpe/global.h> +#include <qpe/qpeapplication.h> +#include <qpe/qpemessagebox.h> +#include <qpe/qcopenvelope_qws.h> +#include <qpe/qpestyle.h> +#include <qpe/lightstyle.h> +#include <qpe/styleinterface.h> + +/* QT */ #include <qbuttongroup.h> #include <qcheckbox.h> @@ -50,29 +74,4 @@ #include <qwhatsthis.h> -#include <qpe/config.h> -#include <qpe/global.h> -#include <qpe/resource.h> -#include <qpe/qpeapplication.h> -#include <qpe/qpemessagebox.h> -#include <qpe/qcopenvelope_qws.h> -#include <qpe/qpestyle.h> -#include <qpe/lightstyle.h> -#include <qpe/qlibrary.h> -#include <qpe/styleinterface.h> - -#include <opie/ofontselector.h> -#include <opie/odevice.h> -#include <opie/ofiledialog.h> -#include <opie/otabwidget.h> - -#include "appearance.h" -#include "editScheme.h" -#include "stylelistitem.h" -#include "decolistitem.h" -#include "colorlistitem.h" -#include "exceptlistitem.h" -#include "sample.h" - - using namespace Opie; @@ -82,11 +81,14 @@ class DefaultWindowDecoration : public WindowDecorationInterface public: DefaultWindowDecoration() : ref(0) {} - QString name() const { + QString name() const + { return "Default"; } -QPixmap icon() const { + QPixmap icon() const + { return QPixmap(); } - QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { + QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ) + { *iface = 0; if ( uuid == IID_QUnknown ) @@ -135,4 +137,5 @@ QWidget *Appearance::createStyleTab ( QWidget *parent, Config &cfg ) m_style_list-> insertItem ( new StyleListItem ( "QPE", new QPEStyle ( ))); #endif + { QString path = QPEApplication::qpeDir ( ); @@ -140,5 +143,6 @@ QWidget *Appearance::createStyleTab ( QWidget *parent, Config &cfg ) QStringList sl = QDir ( path, "lib*.so" ). entryList ( ); - for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { + for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) + { QString libstr = path; libstr.append( "/" ); @@ -147,5 +151,6 @@ QWidget *Appearance::createStyleTab ( QWidget *parent, Config &cfg ) StyleInterface *iface; - if (( lib-> queryInterface ( IID_Style, (QUnknownInterface **) &iface ) == QS_OK ) && iface ) { + if (( lib-> queryInterface ( IID_Style, (QUnknownInterface **) &iface ) == QS_OK ) && iface ) + { StyleListItem *slit = new StyleListItem ( lib, iface ); m_style_list-> insertItem ( slit ); @@ -185,5 +190,6 @@ QWidget *Appearance::createDecoTab ( QWidget *parent, Config &cfg ) QStringList sl = QDir ( path, "lib*.so" ). entryList ( ); - for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { + for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) + { QString libstr = path; libstr.append( "/" ); @@ -192,5 +198,6 @@ QWidget *Appearance::createDecoTab ( QWidget *parent, Config &cfg ) WindowDecorationInterface *iface; - if ( lib-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &iface ) == QS_OK ) { + if ( lib-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &iface ) == QS_OK ) + { DecoListItem *dlit = new DecoListItem ( lib, iface ); m_deco_list-> insertItem ( dlit ); @@ -247,5 +254,6 @@ QWidget *Appearance::createColorTab ( QWidget *parent, Config &cfg ) QStringList sl = QDir ( path ). entryList ( "*.scheme" ); - for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { + for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) + { QString name = (*it). left ((*it). find ( ".scheme" )); QString pathstr = path; @@ -349,5 +357,6 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) QStringList sl = cfg. readListEntry ( "NoStyle", ';' ); QListViewItem *lvit = 0; - for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { + for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) + { int fl = ( *it ). left ( 1 ). toInt ( 0, 32 ); @@ -433,7 +442,10 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) ODirection rot = CW; - if (rotDirection == -1) { + if (rotDirection == -1) + { rot = ODevice::inst ( )-> direction ( ); - } else { + } + else + { rot = (ODirection)rotDirection; } @@ -483,10 +495,10 @@ Appearance::Appearance( QWidget* parent, const char* name, WFlags ) Appearance::~Appearance() -{ -} +{} void Appearance::tabChanged ( QWidget *w ) { - if ( w == m_advtab ) { + if ( w == m_advtab ) + { m_sample-> hide ( ); updateGeometry ( ); // shouldn't be necessary ... @@ -504,5 +516,6 @@ void Appearance::accept ( ) config. setGroup ( "Appearance" ); - if ( m_style_changed ) { + if ( m_style_changed ) + { StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); if ( item ) @@ -510,5 +523,6 @@ void Appearance::accept ( ) } - if ( m_deco_changed ) { + if ( m_deco_changed ) + { DecoListItem *item = (DecoListItem *) m_deco_list-> item ( m_deco_list-> currentItem ( )); if ( item ) @@ -516,10 +530,12 @@ void Appearance::accept ( ) } - if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) { + if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) + { config. writeEntry ( "TabStyle", newtabstyle + 1 ); config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" ); } - if ( m_font_changed ) { + if ( m_font_changed ) + { config. writeEntry ( "FontFamily", m_fontselect-> fontFamily ( )); config. writeEntry ( "FontStyle", m_fontselect-> fontStyle ( )); @@ -537,9 +553,14 @@ void Appearance::accept ( ) ODirection rot; - if (m_rotdir_ccw-> isChecked ( )) { + if (m_rotdir_ccw-> isChecked ( )) + { rot = CCW; - } else if (m_rotdir_cw-> isChecked ( )) { + } + else if (m_rotdir_cw-> isChecked ( )) + { rot = CW; - } else { + } + else + { rot = Flip; } @@ -550,5 +571,6 @@ void Appearance::accept ( ) QStringList sl; QString exceptstr; - for ( ExceptListItem *it = (ExceptListItem *) m_except-> firstChild ( ); it; it = (ExceptListItem *) it-> nextSibling ( )) { + for ( ExceptListItem *it = (ExceptListItem *) m_except-> firstChild ( ); it; it = (ExceptListItem *) it-> nextSibling ( )) + { int fl = 0; fl |= ( it-> noStyle ( ) ? 0x01 : 0 ); @@ -580,5 +602,6 @@ void Appearance::styleClicked ( int index ) m_style_settings-> setEnabled ( sli ? sli-> hasSettings ( ) : false ); - if ( m_sample && sli && sli-> style ( )) { + if ( m_sample && sli && sli-> style ( )) + { int ci = m_color_list ? m_color_list-> currentItem ( ) : -1; @@ -593,5 +616,6 @@ void Appearance::styleSettingsClicked ( ) StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); - if ( item && item-> hasSettings ( )) { + if ( item && item-> hasSettings ( )) + { QDialog *d = new QDialog ( this, "SETTINGS-DLG", true ); QVBoxLayout *vbox = new QVBoxLayout ( d, 3, 0 ); @@ -599,11 +623,11 @@ void Appearance::styleSettingsClicked ( ) QWidget *w = item-> settings ( d ); - if ( w ) { + if ( w ) + { vbox-> addWidget ( w ); d-> setCaption ( w-> caption ( )); - d-> showMaximized ( ); - bool accepted = ( d-> exec ( ) == QDialog::Accepted ); + bool accepted = ( QPEApplication::execDialog ( d ) == QDialog::Accepted ); if ( item-> setSettings ( accepted )) @@ -618,5 +642,6 @@ void Appearance::decoClicked ( int index ) DecoListItem *dli = (DecoListItem *) m_deco_list-> item ( index ); - if ( m_sample ) { + if ( m_sample ) + { if ( dli && dli-> interface ( )) m_sample-> setDecoration ( dli-> interface ( )); @@ -653,8 +678,10 @@ void Appearance::editSchemeClicked ( ) QColor colors [QColorGroup::NColorRoles]; - for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) { + for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) + { QColor col = item-> color ( role ); - if ( col. isValid ( )) { + if ( col. isValid ( )) + { labels [cnt] = item-> label ( role ); colors [cnt] = col; @@ -665,11 +692,13 @@ void Appearance::editSchemeClicked ( ) EditScheme* editdlg = new EditScheme( cnt, labels, colors, this, "editScheme", true ); - editdlg-> showMaximized ( ); - if ( editdlg-> exec ( ) == QDialog::Accepted ) { + if ( QPEApplication::execDialog( editdlg ) == QDialog::Accepted ) + { ColorListItem *citem = (ColorListItem *) m_color_list-> item ( 0 ); cnt = 0; - for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) { - if ( item-> color ( role ). isValid ( )) { + for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) + { + if ( item-> color ( role ). isValid ( )) + { citem-> setColor ( role, colors [cnt] ); cnt++; @@ -699,5 +728,6 @@ void Appearance::saveSchemeClicked() ed-> setFocus ( ); - if ( d-> exec ( ) == QDialog::Accepted ) { + if ( d-> exec ( ) == QDialog::Accepted ) + { QString schemename = ed-> text ( ); QString filestr = QPEApplication::qpeDir(); @@ -762,5 +792,6 @@ void Appearance::addExcept ( ) void Appearance::delExcept ( ) { - if ( m_except-> selectedItem ( )) { + if ( m_except-> selectedItem ( )) + { m_except-> setFocus ( ); delete m_except-> selectedItem ( ); @@ -784,5 +815,6 @@ void Appearance::downExcept ( ) } -class ExEdit : public QLineEdit { +class ExEdit : public QLineEdit +{ public: ExEdit ( ExceptListItem *item ) @@ -823,5 +855,6 @@ public: if ( e-> key ( ) == Key_Return ) it-> listView ( )-> setFocus ( ); - else if ( e-> key ( ) == Key_Escape ) { + else if ( e-> key ( ) == Key_Escape ) + { m_out = false; it-> listView ( )-> setFocus ( ); @@ -849,5 +882,6 @@ void Appearance::clickedExcept ( QListViewItem *item, const QPoint &, int c ) else if ( c == 2 ) it-> setNoDeco ( !it-> noDeco ( )); - else if ( c == 3 ) { + else if ( c == 3 ) + { m_except-> ensureItemVisible ( it ); new ExEdit ( it ); diff --git a/noncore/settings/appearance2/stylelistitem.h b/noncore/settings/appearance2/stylelistitem.h index caefad8..b6c72c3 100644 --- a/noncore/settings/appearance2/stylelistitem.h +++ b/noncore/settings/appearance2/stylelistitem.h @@ -29,6 +29,12 @@ #define STYLELISTITEM_H -#include <qlistbox.h> +/* OPIE */ #include <qpe/styleinterface.h> +#include <qpe/qlibrary.h> +#include <qpe/resource.h> + +/* QT */ +#include <qlistbox.h> +#include <qfileinfo.h> #include <stdio.h> diff --git a/noncore/settings/aqpkg/categoryfilterimpl.cpp b/noncore/settings/aqpkg/categoryfilterimpl.cpp index 61e1f93..217d2c9 100644 --- a/noncore/settings/aqpkg/categoryfilterimpl.cpp +++ b/noncore/settings/aqpkg/categoryfilterimpl.cpp @@ -28,7 +28,10 @@ */ -#include <iostream> -using namespace std; +#include "categoryfilterimpl.h" +/* OPIE */ +#include <qpe/qpeapplication.h> + +/* QT */ #include <qgroupbox.h> #include <qlayout.h> @@ -36,5 +39,8 @@ using namespace std; #include <qstring.h> -#include "categoryfilterimpl.h" +/* STD */ +#include <iostream> +using namespace std; + CategoryFilterImpl :: CategoryFilterImpl(const QString &categories, const QString &selectedCategories, QWidget *parent, const char *name ) @@ -77,14 +83,14 @@ CategoryFilterImpl :: CategoryFilterImpl(const QString &categories, const QStrin start = end + 1; - } while ( start < (int)categories.length() ); + } + while ( start < (int)categories.length() ); lstCategories->sort( true ); - showMaximized(); + QPEApplication::showDialog( this ); } CategoryFilterImpl :: ~CategoryFilterImpl() -{ -} +{} QString CategoryFilterImpl :: getSelectedFilter() diff --git a/noncore/settings/aqpkg/instoptionsimpl.cpp b/noncore/settings/aqpkg/instoptionsimpl.cpp index 9d52013..126e3b9 100644 --- a/noncore/settings/aqpkg/instoptionsimpl.cpp +++ b/noncore/settings/aqpkg/instoptionsimpl.cpp @@ -28,8 +28,15 @@ */ +#include "global.h" +#include "instoptionsimpl.h" +#include "ipkg.h" + +/* OPIE */ #ifdef QWS #include <qpe/config.h> #endif +#include <qpe/qpeapplication.h> +/* QT */ #include <qcheckbox.h> #include <qcombobox.h> @@ -38,8 +45,4 @@ #include <qlayout.h> -#include "global.h" -#include "instoptionsimpl.h" -#include "ipkg.h" - InstallOptionsDlgImpl::InstallOptionsDlgImpl( int flags, int verb, QWidget * parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ) @@ -96,11 +99,10 @@ InstallOptionsDlgImpl::InstallOptionsDlgImpl( int flags, int verb, QWidget * par // makeLinks->setChecked( true ); - showMaximized(); + QPEApplication::showDialog( this ); } InstallOptionsDlgImpl::~InstallOptionsDlgImpl() -{ -} +{} diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp index dbe694e..6f5c712 100644 --- a/noncore/settings/aqpkg/mainwin.cpp +++ b/noncore/settings/aqpkg/mainwin.cpp @@ -28,14 +28,25 @@ */ -#include <linux/limits.h> -#include <unistd.h> +#include "categoryfilterimpl.h" +#include "datamgr.h" +#include "global.h" +#include "inputdlg.h" +#include "ipkg.h" +#include "installdlgimpl.h" +#include "letterpushbutton.h" +#include "mainwin.h" +#include "packagewin.h" +#include "settingsimpl.h" +#include "utils.h" +/* OPIE */ #include <qpe/qcopenvelope_qws.h> -#include <qmenubar.h> #include <qpe/qpeapplication.h> -#include <qtoolbar.h> #include <qpe/config.h> #include <qpe/resource.h> +/* QT */ +#include <qmenubar.h> +#include <qtoolbar.h> #include <qaction.h> #include <qcombobox.h> @@ -53,15 +64,7 @@ #include <qwidgetstack.h> -#include "categoryfilterimpl.h" -#include "datamgr.h" -#include "global.h" -#include "inputdlg.h" -#include "ipkg.h" -#include "installdlgimpl.h" -#include "letterpushbutton.h" -#include "mainwin.h" -#include "packagewin.h" -#include "settingsimpl.h" -#include "utils.h" +/* STD */ +#include <linux/limits.h> +#include <unistd.h> extern int compareVersions( const char *v1, const char *v2 ); @@ -1182,5 +1185,6 @@ void MainWindow :: letterPushed( QString t ) if ( !item ) item = (QCheckListItem *)packagesList->firstChild(); - } while ( item != start); + } + while ( item != start); } @@ -1189,5 +1193,5 @@ void MainWindow :: slotDisplayPackage( QListViewItem *item ) QString itemstr( ((QCheckListItem*)item)->text() ); PackageWindow *p = new PackageWindow( mgr->getServer( serversList->currentText() )->getPackage( itemstr ) ); - p->showMaximized(); + QPEApplication::showWidget( p ); } diff --git a/noncore/settings/aqpkg/settingsimpl.cpp b/noncore/settings/aqpkg/settingsimpl.cpp index 4887ceb..9fdf31e 100644 --- a/noncore/settings/aqpkg/settingsimpl.cpp +++ b/noncore/settings/aqpkg/settingsimpl.cpp @@ -28,8 +28,16 @@ */ -#include <fstream> -#include <algorithm> -using namespace std; +#include "settingsimpl.h" +#include "global.h" + +/* OPIE */ +#include <opie/otabwidget.h> +#ifdef QWS +#include <qpe/config.h> +#include <qpe/resource.h> +#endif +#include <qpe/qpeapplication.h> +/* QT */ #include <qcheckbox.h> #include <qgroupbox.h> @@ -40,14 +48,8 @@ using namespace std; #include <qpushbutton.h> -#include <opie/otabwidget.h> - -#ifdef QWS -#include <qpe/config.h> -#include <qpe/resource.h> -#endif - -#include "settingsimpl.h" - -#include "global.h" +/* STD */ +#include <fstream> +#include <algorithm> +using namespace std; SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl ) @@ -79,12 +81,9 @@ SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const SettingsImpl :: ~SettingsImpl() { - } bool SettingsImpl :: showDlg() { - showMaximized(); - exec(); - + QPEApplication::execDialog( this ); if ( changed ) dataMgr->writeOutIpkgConf(); @@ -463,4 +462,5 @@ void SettingsImpl :: changeDestinationDetails() cfg.writeEntry( key, val ); #endif + } } @@ -477,4 +477,5 @@ void SettingsImpl :: changeDestinationDetails() cfg.writeEntry( key, true ); #endif + } } diff --git a/noncore/settings/backup/backuprestore.cpp b/noncore/settings/backup/backuprestore.cpp index a00193d..977c283 100644 --- a/noncore/settings/backup/backuprestore.cpp +++ b/noncore/settings/backup/backuprestore.cpp @@ -1,10 +1,13 @@ #include "backuprestore.h" -//#include "output.h" #include "errordialog.h" +/* OPIE */ +#include <opie2/ostorageinfo.h> +#include <qpe/qpeapplication.h> + +/* QT */ #include <qapplication.h> #include <qmultilineedit.h> - #include <qdir.h> #include <qfile.h> @@ -22,6 +25,6 @@ #include <qtextstream.h> #include <qtextview.h> -#include <opie2/ostorageinfo.h> +/* STD */ #include <errno.h> #include <stdlib.h> @@ -42,5 +45,4 @@ BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name, WFlags f : BackupAndRestoreBase(parent, name, fl) { - this->showMaximized(); backupList->header()->hide(); restoreList->header()->hide(); @@ -131,4 +133,5 @@ BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name, WFlags f } } + QPEApplication::showWidget( this ); } @@ -288,6 +291,5 @@ void BackupAndRestore::backup() pErrDialog->m_textarea->setText( "Unable to open File: /tmp/backup.er" ); } - pErrDialog->showMaximized(); - pErrDialog->exec(); + QPEApplication::execDialog( pErrDialog ); delete pErrDialog; break; @@ -453,6 +455,5 @@ void BackupAndRestore::restore() pErrDialog->m_textarea->setText( tr( "Unable to open File: %1" ).arg( "/tmp/backup.er" ) ); } - pErrDialog->showMaximized(); - pErrDialog->exec(); + QPEApplication::execDialog( pErrDialog ); delete pErrDialog; diff --git a/noncore/settings/networksettings/ppp/devices.cpp b/noncore/settings/networksettings/ppp/devices.cpp index e94904b..9da090d 100644 --- a/noncore/settings/networksettings/ppp/devices.cpp +++ b/noncore/settings/networksettings/ppp/devices.cpp @@ -25,6 +25,16 @@ */ +#include "interfaceppp.h" +#include "devices.h" +#include "authwidget.h" +#include "pppdata.h" +#include "edit.h" +#include "general.h" + +/* OPIE */ +#include <qpe/qpeapplication.h> + +/* QT */ #include <qdir.h> -#include <stdlib.h> #include <qlayout.h> #include <qtabwidget.h> @@ -32,5 +42,4 @@ #include <qwhatsthis.h> #include <qmessagebox.h> - #include <qapplication.h> #include <qbuttongroup.h> @@ -38,10 +47,7 @@ #include <qvgroupbox.h> -#include "interfaceppp.h" -#include "devices.h" -#include "authwidget.h" -#include "pppdata.h" -#include "edit.h" -#include "general.h" +/* STD */ +#include <stdlib.h> + void parseargs(char* buf, char** args); @@ -192,6 +198,5 @@ int DevicesWidget::doTab(){ while (!ok){ - dlg->showMaximized(); - result = dlg->exec(); + result = QPEApplication::execDialog( dlg ); ok = true; diff --git a/noncore/settings/networksettings/ppp/edit.cpp b/noncore/settings/networksettings/ppp/edit.cpp index ceac90c..7d21605 100644 --- a/noncore/settings/networksettings/ppp/edit.cpp +++ b/noncore/settings/networksettings/ppp/edit.cpp @@ -24,6 +24,14 @@ */ -#include <string.h> -#include <termios.h> +#include "edit.h" +#include "pppdata.h" +#include "iplined.h" +#include "auth.h" + +/* OPIE */ +#include <qpe/resource.h> +#include <qpe/qpeapplication.h> + +/* QT */ #include <qlayout.h> #include <qmessagebox.h> @@ -35,10 +43,9 @@ #include <qhbox.h> #include <qdialog.h> -#include <qpe/resource.h> -#include "edit.h" -#include "pppdata.h" -#include "iplined.h" -#include "auth.h" +/* STD */ + +#include <string.h> +#include <termios.h> DialWidget::DialWidget( PPPData *pd, QWidget *parent, bool isnewaccount @@ -113,5 +120,6 @@ DialWidget::DialWidget( PPPData *pd, QWidget *parent, bool isnewaccount // Set defaults if editing an existing connection - if(!isnewaccount) { + if(!isnewaccount) + { connectname_l->setText(_pppdata->accname()); @@ -120,10 +128,13 @@ DialWidget::DialWidget( PPPData *pd, QWidget *parent, bool isnewaccount QString tmp = ""; uint idx = 0; - while(idx != n.length()) { - if(n[idx] == ':') { + while(idx != n.length()) + { + if(n[idx] == ':') + { if(tmp.length() > 0) numbers->insertItem(tmp); tmp = ""; - } else + } + else tmp += n[idx]; idx++; @@ -138,14 +149,19 @@ DialWidget::DialWidget( PPPData *pd, QWidget *parent, bool isnewaccount } -bool DialWidget::save() { +bool DialWidget::save() +{ //first check to make sure that the account name is unique! if(connectname_l->text().isEmpty() || - !_pppdata->isUniqueAccname(connectname_l->text())) { + !_pppdata->isUniqueAccname(connectname_l->text())) + { return false; - } else { + } + else + { _pppdata->setAccname(connectname_l->text()); QString number = ""; - for(uint i = 0; i < numbers->count(); i++) { + for(uint i = 0; i < numbers->count(); i++) + { if(i != 0) number += ":"; @@ -159,5 +175,6 @@ bool DialWidget::save() { -void DialWidget::numbersChanged() { +void DialWidget::numbersChanged() +{ int sel = numbers->currentItem(); @@ -168,12 +185,15 @@ void DialWidget::numbersChanged() { -void DialWidget::selectionChanged(int) { +void DialWidget::selectionChanged(int) +{ numbersChanged(); } -void DialWidget::addNumber() { +void DialWidget::addNumber() +{ PhoneNumberDialog dlg(this); - if(dlg.exec()) { + if(dlg.exec()) + { numbers->insertItem(dlg.phoneNumber()); numbersChanged(); @@ -182,6 +202,8 @@ void DialWidget::addNumber() { -void DialWidget::delNumber() { - if(numbers->currentItem() != -1) { +void DialWidget::delNumber() +{ + if(numbers->currentItem() != -1) + { numbers->removeItem(numbers->currentItem()); numbersChanged(); @@ -190,7 +212,9 @@ void DialWidget::delNumber() { -void DialWidget::upNumber() { +void DialWidget::upNumber() +{ int idx = numbers->currentItem(); - if(idx != -1) { + if(idx != -1) + { QString item = numbers->text(idx); numbers->removeItem(idx); @@ -202,7 +226,9 @@ void DialWidget::upNumber() { -void DialWidget::downNumber() { +void DialWidget::downNumber() +{ int idx = numbers->currentItem(); - if(idx != -1) { + if(idx != -1) + { QString item = numbers->text(idx); numbers->removeItem(idx); @@ -214,8 +240,8 @@ void DialWidget::downNumber() { -void DialWidget::pppdargsbutton() { +void DialWidget::pppdargsbutton() +{ PPPdArguments pa(_pppdata, this); - pa.showMaximized(); - pa.exec(); + QPEApplication::execDialog( &pa ); } @@ -306,5 +332,6 @@ ExecWidget::ExecWidget(PPPData *pd, QWidget *parent, bool isnewaccount, const ch // Set defaults if editing an existing connection - if(!isnewaccount) { + if(!isnewaccount) + { before_connect->setText(_pppdata->command_before_connect()); command->setText(_pppdata->command_on_connect()); @@ -315,5 +342,6 @@ ExecWidget::ExecWidget(PPPData *pd, QWidget *parent, bool isnewaccount, const ch -bool ExecWidget::save() { +bool ExecWidget::save() +{ _pppdata->setCommand_before_connect(before_connect->text()); _pppdata->setCommand_on_connect(command->text()); @@ -415,12 +443,15 @@ IPWidget::IPWidget( PPPData *pd, QWidget *parent, bool isnewaccount, const char //load info from gpppdata - if(!isnewaccount) { + if(!isnewaccount) + { if(_pppdata->ipaddr() == "0.0.0.0" && - _pppdata->subnetmask() == "0.0.0.0") { + _pppdata->subnetmask() == "0.0.0.0") + { dynamicadd_rb->setChecked(true); hitIPSelect(0); autoname->setChecked(_pppdata->autoname()); } - else { + else + { ipaddress_l->setText(_pppdata->ipaddr()); subnetmask_l->setText(_pppdata->subnetmask()); @@ -429,5 +460,6 @@ IPWidget::IPWidget( PPPData *pd, QWidget *parent, bool isnewaccount, const char } } - else { + else + { dynamicadd_rb->setChecked(true); hitIPSelect(0); @@ -436,9 +468,11 @@ IPWidget::IPWidget( PPPData *pd, QWidget *parent, bool isnewaccount, const char } -void IPWidget::autoname_t(bool on) { +void IPWidget::autoname_t(bool on) +{ static bool was_warned = false; // big-fat warning when selecting the auto configure hostname option - if(on && !was_warned) { + if(on && !was_warned) + { QMessageBox::information(this, tr("Selecting this option might cause some weird " @@ -455,9 +489,13 @@ void IPWidget::autoname_t(bool on) { -void IPWidget::save() { - if(dynamicadd_rb->isChecked()) { +void IPWidget::save() +{ + if(dynamicadd_rb->isChecked()) + { _pppdata->setIpaddr("0.0.0.0"); _pppdata->setSubnetmask("0.0.0.0"); - } else { + } + else + { _pppdata->setIpaddr(ipaddress_l->text()); _pppdata->setSubnetmask(subnetmask_l->text()); @@ -467,6 +505,8 @@ void IPWidget::save() { -void IPWidget::hitIPSelect( int i ) { - if(i == 0) { +void IPWidget::hitIPSelect( int i ) +{ + if(i == 0) + { ipaddress_label->setEnabled(false); sub_label->setEnabled(false); @@ -474,5 +514,6 @@ void IPWidget::hitIPSelect( int i ) { subnetmask_l->setEnabled(false); } - else { + else + { ipaddress_label->setEnabled(true); sub_label->setEnabled(true); @@ -598,5 +639,6 @@ DNSWidget::DNSWidget( PPPData *pd, QWidget *parent, bool isnewaccount, const cha // restore data if editing - if(!isnewaccount) { + if(!isnewaccount) + { dnsservers->insertStringList(_pppdata->dns()); dnsdomain->setText(_pppdata->domain()); @@ -610,14 +652,17 @@ DNSWidget::DNSWidget( PPPData *pd, QWidget *parent, bool isnewaccount, const cha } -void DNSWidget::DNS_Edit_Changed(const QString &text) { +void DNSWidget::DNS_Edit_Changed(const QString &text) +{ QRegExp r("[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+"); add->setEnabled(text.find(r) != -1); } -void DNSWidget::DNS_Entry_Selected(int) { +void DNSWidget::DNS_Entry_Selected(int) +{ remove->setEnabled(true); } -void DNSWidget::DNS_Mode_Selected(int mode) { +void DNSWidget::DNS_Mode_Selected(int mode) +{ bool on = (mode == 1); dns_label->setEnabled(on); @@ -632,5 +677,6 @@ void DNSWidget::DNS_Mode_Selected(int mode) { } -void DNSWidget::save() { +void DNSWidget::save() +{ _pppdata->setAutoDNS(bg->id(bg->selected()) == 0); QStringList serverlist; @@ -650,6 +696,8 @@ void DNSWidget::save() { -void DNSWidget::adddns() { - if(dnsservers->count() < MAX_DNS_ENTRIES) { +void DNSWidget::adddns() +{ + if(dnsservers->count() < MAX_DNS_ENTRIES) + { dnsservers->insertItem(dnsipaddr->text()); dnsipaddr->setText(""); @@ -658,5 +706,6 @@ void DNSWidget::adddns() { -void DNSWidget::removedns() { +void DNSWidget::removedns() +{ int i; i = dnsservers->currentItem(); @@ -722,10 +771,13 @@ GatewayWidget::GatewayWidget( PPPData *pd, QWidget *parent, bool isnewaccount, c //load info from gpppdata - if(!isnewaccount) { - if(_pppdata->gateway() == "0.0.0.0") { + if(!isnewaccount) + { + if(_pppdata->gateway() == "0.0.0.0") + { defaultgateway->setChecked(true); hitGatewaySelect(0); } - else { + else + { gatewayaddr->setText(_pppdata->gateway()); staticgateway->setChecked(true); @@ -733,5 +785,6 @@ GatewayWidget::GatewayWidget( PPPData *pd, QWidget *parent, bool isnewaccount, c defaultroute->setChecked(_pppdata->defaultroute()); } - else { + else + { defaultgateway->setChecked(true); hitGatewaySelect(0); @@ -740,5 +793,6 @@ GatewayWidget::GatewayWidget( PPPData *pd, QWidget *parent, bool isnewaccount, c } -void GatewayWidget::save() { +void GatewayWidget::save() +{ _pppdata->setGateway(gatewayaddr->text()); _pppdata->setDefaultroute(defaultroute->isChecked()); @@ -746,11 +800,14 @@ void GatewayWidget::save() { -void GatewayWidget::hitGatewaySelect( int i ) { - if(i == 0) { +void GatewayWidget::hitGatewaySelect( int i ) +{ + if(i == 0) + { gatewayaddr->setText("0.0.0.0"); gatewayaddr->setEnabled(false); gate_label->setEnabled(false); } - else { + else + { gatewayaddr->setEnabled(true); gatewayaddr->setText(""); @@ -804,5 +861,6 @@ ScriptWidget::ScriptWidget( PPPData *pd, QWidget *parent, bool isnewaccount, con //load data from gpppdata - if(!isnewaccount) { + if(!isnewaccount) + { QStringList &comlist = _pppdata->scriptType(); QStringList &arglist = _pppdata->script(); @@ -825,15 +883,20 @@ ScriptWidget::ScriptWidget( PPPData *pd, QWidget *parent, bool isnewaccount, con } -bool ScriptWidget::check() { +bool ScriptWidget::check() +{ uint lstart = 0; uint lend = 0; uint errcnt = 0; - if(sl->count() > 0) { - for( uint i=0; i <= sl->count()-1; i++) { - if(stl->text(i) == "LoopStart") { + if(sl->count() > 0) + { + for( uint i=0; i <= sl->count()-1; i++) + { + if(stl->text(i) == "LoopStart") + { lstart++; } - if (stl->text(i) == "LoopEnd") { + if (stl->text(i) == "LoopEnd") + { lend++; } @@ -846,7 +909,9 @@ bool ScriptWidget::check() { -void ScriptWidget::save() { +void ScriptWidget::save() +{ QStringList typelist, arglist; - for(uint i=0; i < sl->count(); i++) { + for(uint i=0; i < sl->count(); i++) + { typelist.append(stl->text(i)); arglist.append(sl->text(i)); @@ -858,5 +923,6 @@ void ScriptWidget::save() { -void ScriptWidget::adjustScrollBar() { +void ScriptWidget::adjustScrollBar() +{ if((int)sl->count() <= sl->numItemsVisible()) slb->setRange(0, 0); @@ -866,5 +932,6 @@ void ScriptWidget::adjustScrollBar() { -void ScriptWidget::scrolling(int i) { +void ScriptWidget::scrolling(int i) +{ sl->setTopItem(i); stl->setTopItem(i); @@ -872,5 +939,6 @@ void ScriptWidget::scrolling(int i) { -void ScriptWidget::slhighlighted(int i) { +void ScriptWidget::slhighlighted(int i) +{ insert->setEnabled(true); remove->setEnabled(true); @@ -879,5 +947,6 @@ void ScriptWidget::slhighlighted(int i) { -void ScriptWidget::stlhighlighted(int i) { +void ScriptWidget::stlhighlighted(int i) +{ insert->setEnabled(true); remove->setEnabled(true); @@ -886,10 +955,12 @@ void ScriptWidget::stlhighlighted(int i) { -void ScriptWidget::addButton() { +void ScriptWidget::addButton() +{ //don't allow more than the maximum script entries if(sl->count() == MAX_SCRIPT_ENTRIES-1) return; - switch(se->type()) { + switch(se->type()) + { case ScriptEdit::Expect: stl->insertItem("Expect"); @@ -981,5 +1052,6 @@ void ScriptWidget::addButton() { -void ScriptWidget::insertButton() { +void ScriptWidget::insertButton() +{ //exit if there is no highlighted item, or we've reached the //maximum entries in the script list @@ -987,5 +1059,6 @@ void ScriptWidget::insertButton() { return; - switch(se->type()) { + switch(se->type()) + { case ScriptEdit::Expect: stl->insertItem("Expect", stl->currentItem()); @@ -1071,6 +1144,8 @@ void ScriptWidget::insertButton() { -void ScriptWidget::removeButton() { - if(sl->currentItem() >= 0) { +void ScriptWidget::removeButton() +{ + if(sl->currentItem() >= 0) + { int stlc = stl->currentItem(); sl->removeItem(sl->currentItem()); @@ -1120,5 +1195,6 @@ PhoneNumberDialog::PhoneNumberDialog(QWidget *parent) -QString PhoneNumberDialog::phoneNumber() { +QString PhoneNumberDialog::phoneNumber() +{ QString s = le->text(); @@ -1127,5 +1203,6 @@ QString PhoneNumberDialog::phoneNumber() { -void PhoneNumberDialog::textChanged(const QString &s) { +void PhoneNumberDialog::textChanged(const QString &s) +{ // enableButtonOK(s.length() > 0); } diff --git a/noncore/settings/sysinfo/modulesinfo.cpp b/noncore/settings/sysinfo/modulesinfo.cpp index 566b179..9cb8ad2 100644 --- a/noncore/settings/sysinfo/modulesinfo.cpp +++ b/noncore/settings/sysinfo/modulesinfo.cpp @@ -20,6 +20,11 @@ **********************************************************************/ +#include "modulesinfo.h" +#include "detail.h" + +/* OPIE */ #include <qpe/qpeapplication.h> +/* QT */ #include <qfile.h> #include <qlayout.h> @@ -28,7 +33,4 @@ #include <qwhatsthis.h> -#include "modulesinfo.h" -#include "detail.h" - ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl ) : QWidget( parent, name, fl ) @@ -83,6 +85,5 @@ ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl ) ModulesInfo::~ModulesInfo() -{ -} +{} void ModulesInfo::updateData() @@ -107,5 +108,6 @@ void ModulesInfo::updateData() QListViewItem *newitem; QListViewItem *selecteditem = 0x0; - while ( true ) { + while ( true ) + { modname[0] = '\0'; usage[0] = '\0'; @@ -184,5 +186,5 @@ void ModulesInfo::viewModules( QListViewItem *modules ) } - ModulesDtl->showMaximized(); + QPEApplication::showWidget( ModulesDtl ); } diff --git a/noncore/settings/sysinfo/processinfo.cpp b/noncore/settings/sysinfo/processinfo.cpp index af0fe26..2a90b0f 100644 --- a/noncore/settings/sysinfo/processinfo.cpp +++ b/noncore/settings/sysinfo/processinfo.cpp @@ -18,6 +18,11 @@ **********************************************************************/ +#include "processinfo.h" +#include "detail.h" + +/* OPIE */ #include <qpe/qpeapplication.h> +/* QT */ #include <qdir.h> #include <qlayout.h> @@ -26,10 +31,8 @@ #include <qwhatsthis.h> +/* STD */ #include <sys/types.h> #include <signal.h> -#include "processinfo.h" -#include "detail.h" - ProcessInfo::ProcessInfo( QWidget* parent, const char* name, WFlags fl ) : QWidget( parent, name, fl ) @@ -87,6 +90,5 @@ ProcessInfo::ProcessInfo( QWidget* parent, const char* name, WFlags fl ) ProcessInfo::~ProcessInfo() -{ -} +{} void ProcessInfo::updateData() @@ -197,4 +199,4 @@ void ProcessInfo::viewProcess( QListViewItem *process ) fclose( statfile ); } - ProcessDtl->showMaximized(); + QPEApplication::showWidget( ProcessDtl ); } diff --git a/noncore/settings/usermanager/userdialog.cpp b/noncore/settings/usermanager/userdialog.cpp index d87a005..08de352 100644 --- a/noncore/settings/usermanager/userdialog.cpp +++ b/noncore/settings/usermanager/userdialog.cpp @@ -9,5 +9,11 @@ #include "userdialog.h" +#include "passwd.h" + +/* OPIE */ +#include <opie/odevice.h> +#include <qpe/qpeapplication.h> +/* QT */ #include <qlayout.h> #include <qlabel.h> @@ -15,4 +21,5 @@ #include <qfile.h> +/* STD */ #include <sys/types.h> #include <sys/wait.h> @@ -20,7 +27,5 @@ #include <signal.h> -#include "passwd.h" -#include <opie/odevice.h> using namespace Opie; @@ -30,5 +35,6 @@ using namespace Opie; * */ -UserDialog::UserDialog(int viewmode, QWidget* parent, const char* name, bool modal, WFlags fl) : QDialog(parent, name, modal, fl) { +UserDialog::UserDialog(int viewmode, QWidget* parent, const char* name, bool modal, WFlags fl) : QDialog(parent, name, modal, fl) +{ vm=viewmode; QVBoxLayout *layout = new QVBoxLayout(this); @@ -40,12 +46,14 @@ UserDialog::UserDialog(int viewmode, QWidget* parent, const char* name, bool mod accounts->groupStringList.sort(); // And also fill the listview & the combobox with all available groups. - for( QStringList::Iterator it = accounts->groupStringList.begin(); it!=accounts->groupStringList.end(); ++it) { + for( QStringList::Iterator it = accounts->groupStringList.begin(); it!=accounts->groupStringList.end(); ++it) + { accounts->splitGroupEntry(*it); - if(accounts->gr_name.find(QRegExp("^#"),0)) { // Skip commented lines. + if(accounts->gr_name.find(QRegExp("^#"),0)) + { // Skip commented lines. new QCheckListItem(groupsListView,accounts->gr_name,QCheckListItem::CheckBox); groupComboBox->insertItem(accounts->gr_name); } } - showMaximized(); + QPEApplication::showDialog( this ); } @@ -54,6 +62,6 @@ UserDialog::UserDialog(int viewmode, QWidget* parent, const char* name, bool mod * */ -UserDialog::~UserDialog() { -} +UserDialog::~UserDialog() +{} /** @@ -61,5 +69,6 @@ UserDialog::~UserDialog() { * */ -void UserDialog::setupTab1() { +void UserDialog::setupTab1() +{ QPixmap mypixmap; QWidget *tabpage = new QWidget(myTabWidget,"page1"); @@ -110,5 +119,6 @@ void UserDialog::setupTab1() { groupComboBox=new QComboBox(tabpage,"PrimaryGroup"); - if(vm==VIEWMODE_NEW) { + if(vm==VIEWMODE_NEW) + { // Copy /etc/skel skelLabel=new QLabel(tabpage,"skel"); @@ -137,5 +147,6 @@ void UserDialog::setupTab1() { vlayout1->addSpacing(5); vlayout1->addWidget(groupLabel); - if(vm==VIEWMODE_NEW) { + if(vm==VIEWMODE_NEW) + { vlayout1->addSpacing(5); vlayout1->addWidget(skelLabel); @@ -153,5 +164,6 @@ void UserDialog::setupTab1() { vlayout2->addSpacing(5); vlayout2->addWidget(groupComboBox); - if(vm==VIEWMODE_NEW) { + if(vm==VIEWMODE_NEW) + { vlayout2->addSpacing(5); vlayout2->addWidget(skelCheckBox); @@ -167,5 +179,6 @@ void UserDialog::setupTab1() { * */ -void UserDialog::setupTab2() { +void UserDialog::setupTab2() +{ QWidget *tabpage = new QWidget(myTabWidget,"page2"); QVBoxLayout *layout = new QVBoxLayout(tabpage); @@ -196,5 +209,6 @@ void UserDialog::setupTab2() { * */ -bool UserDialog::addUser(int uid, int gid) { +bool UserDialog::addUser(int uid, int gid) +{ QCheckListItem *temp; QFile ozTest; @@ -210,7 +224,9 @@ bool UserDialog::addUser(int uid, int gid) { adduserDialog->uidLineEdit->setText(QString::number(uid)); // If we're running on OZ, add new users to some default groups. - if(oz) { + if(oz) + { QListViewItemIterator iter( adduserDialog->groupsListView ); - for ( ; iter.current(); ++iter ) { + for ( ; iter.current(); ++iter ) + { temp=(QCheckListItem*)iter.current(); if (temp->text()=="video") temp->setOn(true); @@ -225,5 +241,6 @@ bool UserDialog::addUser(int uid, int gid) { // Show the dialog! if(!(adduserDialog->exec())) return false; - if((adduserDialog->groupComboBox->currentItem()!=0)) { + if((adduserDialog->groupComboBox->currentItem()!=0)) + { accounts->findGroup(adduserDialog->groupComboBox->currentText()); adduserDialog->groupID=accounts->gr_gid; @@ -232,5 +249,6 @@ bool UserDialog::addUser(int uid, int gid) { if(!(accounts->addUser(adduserDialog->loginLineEdit->text(), adduserDialog->passwordLineEdit->text(), adduserDialog->uidLineEdit->text().toInt(), adduserDialog->groupID, adduserDialog->gecosLineEdit->text(), - QString("/home/")+adduserDialog->loginLineEdit->text() , adduserDialog->shellComboBox->currentText()))) { + QString("/home/")+adduserDialog->loginLineEdit->text() , adduserDialog->shellComboBox->currentText()))) + { QMessageBox::information(0,"Ooops!","Something went wrong!\nUnable to add user."); return false; @@ -239,5 +257,6 @@ bool UserDialog::addUser(int uid, int gid) { // Add User to additional groups. QListViewItemIterator it( adduserDialog->groupsListView ); - for ( ; it.current(); ++it ) { + for ( ; it.current(); ++it ) + { temp=(QCheckListItem*)it.current(); if (temp->isOn() ) @@ -245,7 +264,9 @@ bool UserDialog::addUser(int uid, int gid) { } // Copy image to pics/users/ - if(!(adduserDialog->userImage.isNull())) { + if(!(adduserDialog->userImage.isNull())) + { QDir d; - if(!(d.exists("/opt/QtPalmtop/pics/users"))) { + if(!(d.exists("/opt/QtPalmtop/pics/users"))) + { d.mkdir("/opt/QtPalmtop/pics/users"); } @@ -257,5 +278,6 @@ bool UserDialog::addUser(int uid, int gid) { // Should we copy the skeleton homedirectory /etc/skel to the user's homedirectory? accounts->findUser(adduserDialog->loginLineEdit->text()); - if(adduserDialog->skelCheckBox->isChecked()) { + if(adduserDialog->skelCheckBox->isChecked()) + { QString command_cp; QString command_chown; @@ -281,10 +303,15 @@ bool UserDialog::addUser(int uid, int gid) { * */ -bool UserDialog::delUser(const char *username) { - if((accounts->findUser(username))) { // Does that user exist? - if(!(accounts->delUser(username))) { // Delete the user. +bool UserDialog::delUser(const char *username) +{ + if((accounts->findUser(username))) + { // Does that user exist? + if(!(accounts->delUser(username))) + { // Delete the user. QMessageBox::information(0,"Ooops!","Something went wrong\nUnable to delete user: "+QString(username)+"."); } - } else { + } + else + { QMessageBox::information(0,"Invalid Username","That username ("+QString(username)+")does not exist."); return false; @@ -302,5 +329,6 @@ bool UserDialog::delUser(const char *username) { * */ -bool UserDialog::editUser(const char *username) { +bool UserDialog::editUser(const char *username) +{ int invalid_group=0; // viewmode is a workaround for a bug in qte-2.3.4 that gives bus error on manipulating edituserDialog's widgets here. @@ -308,5 +336,6 @@ bool UserDialog::editUser(const char *username) { edituserDialog->setCaption(tr("Edit User")); accounts->findUser(username); // Locate user in database and fill variables in 'accounts' object. - if(!(accounts->findGroup(accounts->pw_gid))) { // Locate the user's primary group, and fill group variables in 'accounts' object. + if(!(accounts->findGroup(accounts->pw_gid))) + { // Locate the user's primary group, and fill group variables in 'accounts' object. invalid_group=1; } @@ -318,16 +347,20 @@ bool UserDialog::editUser(const char *username) { edituserDialog->passwordLineEdit->setText("........"); // If this user is not using /bin/sh,/bin/ash or /bin/false as shell, add that entry to the shell-combobox. - if(accounts->pw_shell!="/bin/sh" && accounts->pw_shell!="/bin/ash" && accounts->pw_shell!="/bin/false") { + if(accounts->pw_shell!="/bin/sh" && accounts->pw_shell!="/bin/ash" && accounts->pw_shell!="/bin/false") + { edituserDialog->shellComboBox->insertItem(accounts->pw_shell,0); edituserDialog->shellComboBox->setCurrentItem(0); } // Select the primary group for this user. - for(int i=0;i<edituserDialog->groupComboBox->count();++i) { - if(accounts->gr_name==edituserDialog->groupComboBox->text(i)) { + for(int i=0;i<edituserDialog->groupComboBox->count();++i) + { + if(accounts->gr_name==edituserDialog->groupComboBox->text(i)) + { edituserDialog->groupComboBox->setCurrentItem(i); break; } } - if(invalid_group) { + if(invalid_group) + { edituserDialog->groupComboBox->insertItem("<Undefined group>",0); edituserDialog->groupComboBox->setCurrentItem(0); @@ -339,9 +372,12 @@ bool UserDialog::editUser(const char *username) { QRegExp userRegExp(QString("[:,]%1$").arg(username)); // The end of line variant. QStringList tempList=accounts->groupStringList.grep(userRegExp); // Find all entries in the group database, that the user is a member of. - for(QStringList::Iterator it=tempList.begin(); it!=tempList.end(); ++it) { // Iterate over all of them. + for(QStringList::Iterator it=tempList.begin(); it!=tempList.end(); ++it) + { // Iterate over all of them. qWarning(*it); QListViewItemIterator lvit( edituserDialog->groupsListView ); // Compare to all groups. - for ( ; lvit.current(); ++lvit ) { - if(lvit.current()->text(0)==(*it).left((*it).find(":"))) { + for ( ; lvit.current(); ++lvit ) + { + if(lvit.current()->text(0)==(*it).left((*it).find(":"))) + { temp=(QCheckListItem*)lvit.current(); temp->setOn(true); // If we find a line with that groupname, select it.; @@ -351,9 +387,12 @@ bool UserDialog::editUser(const char *username) { userRegExp=QRegExp(QString("[:,]%1,").arg(username)); // And the other one. (not end of line.) tempList=accounts->groupStringList.grep(userRegExp); // Find all entries in the group database, that the user is a member of. - for(QStringList::Iterator it=tempList.begin(); it!=tempList.end(); ++it) { // Iterate over all of them. + for(QStringList::Iterator it=tempList.begin(); it!=tempList.end(); ++it) + { // Iterate over all of them. qWarning(*it); QListViewItemIterator lvit( edituserDialog->groupsListView ); // Compare to all groups. - for ( ; lvit.current(); ++lvit ) { - if(lvit.current()->text(0)==(*it).left((*it).find(":"))) { + for ( ; lvit.current(); ++lvit ) + { + if(lvit.current()->text(0)==(*it).left((*it).find(":"))) + { temp=(QCheckListItem*)lvit.current(); temp->setOn(true); // If we find a line with that groupname, select it.; @@ -371,5 +410,6 @@ bool UserDialog::editUser(const char *username) { // Set all variables in accounts object, that will be used when calling 'updateUser()' accounts->pw_uid=edituserDialog->uidLineEdit->text().toInt(); - if(accounts->findGroup(edituserDialog->groupComboBox->currentText())) { // Fill all group variables in 'accounts' object. + if(accounts->findGroup(edituserDialog->groupComboBox->currentText())) + { // Fill all group variables in 'accounts' object. accounts->pw_gid=accounts->gr_gid; // Only do this if the group is a valid group (ie. "<Undefined group>"), otherwise keep the old group. } @@ -380,5 +420,6 @@ bool UserDialog::editUser(const char *username) { // Remove user from all groups he/she is a member of. (could be done in a better way I guess, this was simple though.) - for(QStringList::Iterator it=tempList.begin(); it!=tempList.end(); ++it) { + for(QStringList::Iterator it=tempList.begin(); it!=tempList.end(); ++it) + { accounts->delGroupMember((*it).left((*it).find(":")),username); } @@ -386,5 +427,6 @@ bool UserDialog::editUser(const char *username) { // Add User to additional groups that he/she is a member of. QListViewItemIterator it( edituserDialog->groupsListView ); - for ( ; it.current(); ++it ) { + for ( ; it.current(); ++it ) + { temp=(QCheckListItem*)it.current(); if ( temp->isOn() ) @@ -393,7 +435,9 @@ bool UserDialog::editUser(const char *username) { // Copy image to pics/users/ - if(!(edituserDialog->userImage.isNull())) { + if(!(edituserDialog->userImage.isNull())) + { QDir d; - if(!(d.exists("/opt/QtPalmtop/pics/users"))) { + if(!(d.exists("/opt/QtPalmtop/pics/users"))) + { d.mkdir("/opt/QtPalmtop/pics/users"); } @@ -409,7 +453,9 @@ bool UserDialog::editUser(const char *username) { * */ -void UserDialog::accept() { +void UserDialog::accept() +{ // Add checking... valid username? username taken? - if(loginLineEdit->text().isEmpty()) { + if(loginLineEdit->text().isEmpty()) + { QMessageBox::information(0,"Empty Login","Please enter a login."); return; @@ -422,11 +468,16 @@ void UserDialog::accept() { * */ -void UserDialog::clickedPicture() { +void UserDialog::clickedPicture() +{ QString filename=OFileDialog::getOpenFileName(OFileSelector::EXTENDED, QString::null); - if(!(filename.isEmpty())) { + if(!(filename.isEmpty())) + { userImage.reset(); - if(!(userImage.load(filename))) { + if(!(userImage.load(filename))) + { QMessageBox::information(0,"Sorry!","That icon could not be loaded.\nLoading failed on: "+filename); - } else { + } + else + { // userImage=userImage.smoothScale(48,48); QPixmap *picture; |