-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 @@ -27,6 +27,30 @@ */ +#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> #include <qcombobox.h> @@ -49,31 +73,6 @@ #include <qvbox.h> #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; @@ -81,13 +80,16 @@ 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 ) *iface = this; @@ -134,19 +136,22 @@ QWidget *Appearance::createStyleTab ( QWidget *parent, Config &cfg ) m_style_list-> insertItem ( new StyleListItem ( "Light", new LightStyle ( ))); m_style_list-> insertItem ( new StyleListItem ( "QPE", new QPEStyle ( ))); #endif + { QString path = QPEApplication::qpeDir ( ); path.append( "/plugins/styles/" ); 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( "/" ); libstr.append( *it ); QLibrary *lib = new QLibrary ( libstr ); 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 ); @@ -184,14 +189,16 @@ QWidget *Appearance::createDecoTab ( QWidget *parent, Config &cfg ) path.append( "/plugins/decorations/" ); 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( "/" ); libstr.append( *it ); QLibrary *lib = new QLibrary ( libstr ); 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 ); @@ -246,7 +253,8 @@ QWidget *Appearance::createColorTab ( QWidget *parent, Config &cfg ) path.append( "/etc/colors/" ); 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; pathstr.append( *it ); @@ -348,7 +356,8 @@ 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 ); lvit = new ExceptListItem ( m_except, lvit, ( *it ). mid ( 1 ), fl & 0x01, fl & 0x02, fl & 0x04 ); @@ -432,9 +441,12 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) int rotDirection = cfg.readNumEntry( "rotatedir" ); ODirection rot = CW; - if (rotDirection == -1) { + if (rotDirection == -1) + { rot = ODevice::inst ( )-> direction ( ); - } else { + } + else + { rot = (ODirection)rotDirection; } @@ -482,12 +494,12 @@ 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 ... } @@ -503,24 +515,28 @@ void Appearance::accept ( ) Config config ( "qpe" ); config. setGroup ( "Appearance" ); - if ( m_style_changed ) { + if ( m_style_changed ) + { StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); if ( item ) config.writeEntry( "Style", item-> key ( )); } - if ( m_deco_changed ) { + if ( m_deco_changed ) + { DecoListItem *item = (DecoListItem *) m_deco_list-> item ( m_deco_list-> currentItem ( )); if ( item ) config.writeEntry( "Decoration", item-> key ( )); } - 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 ( )); config. writeEntry ( "FontSize", m_fontselect-> fontSize ( )); @@ -536,11 +552,16 @@ 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; } config. writeEntry ( "rotatedir", (int)rot ); @@ -549,7 +570,8 @@ 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 ); fl |= ( it-> noFont ( ) ? 0x02 : 0 ); @@ -579,7 +601,8 @@ void Appearance::styleClicked ( int index ) StyleListItem *sli = (StyleListItem *) m_style_list-> item ( 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; m_sample-> setStyle2 ( sli-> style ( ), ci < 0 ? palette ( ) : ((ColorListItem *) m_color_list-> item ( ci ))-> palette ( )); @@ -592,19 +615,20 @@ 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 ); 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 )) m_style_changed = true; @@ -617,7 +641,8 @@ 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 ( )); else @@ -652,10 +677,12 @@ void Appearance::editSchemeClicked ( ) QString labels [QColorGroup::NColorRoles]; 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; @@ -664,13 +691,15 @@ 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++; } @@ -698,7 +727,8 @@ void Appearance::saveSchemeClicked() ( new QVBoxLayout ( d, 3, 3 ))-> addWidget ( ed ); ed-> setFocus ( ); - if ( d-> exec ( ) == QDialog::Accepted ) { + if ( d-> exec ( ) == QDialog::Accepted ) + { QString schemename = ed-> text ( ); QString filestr = QPEApplication::qpeDir(); filestr.append( "/etc/colors/" ); @@ -761,7 +791,8 @@ void Appearance::addExcept ( ) void Appearance::delExcept ( ) { - if ( m_except-> selectedItem ( )) { + if ( m_except-> selectedItem ( )) + { m_except-> setFocus ( ); delete m_except-> selectedItem ( ); } @@ -783,7 +814,8 @@ void Appearance::downExcept ( ) it-> moveItem ( it-> itemBelow ( )); } -class ExEdit : public QLineEdit { +class ExEdit : public QLineEdit +{ public: ExEdit ( ExceptListItem *item ) : QLineEdit ( item-> listView ( )-> viewport ( ), "exedit" ), it ( item ) @@ -822,7 +854,8 @@ 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 ( ); } @@ -848,7 +881,8 @@ void Appearance::clickedExcept ( QListViewItem *item, const QPoint &, int c ) it-> setNoFont ( !it-> noFont ( )); 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 @@ -28,8 +28,14 @@ #ifndef STYLELISTITEM_H #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 @@ -27,15 +27,21 @@ */ -#include <iostream> -using namespace std; +#include "categoryfilterimpl.h" +/* OPIE */ +#include <qpe/qpeapplication.h> + +/* QT */ #include <qgroupbox.h> #include <qlayout.h> #include <qlistbox.h> #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 ) : QDialog( parent, name, true ) @@ -76,16 +82,16 @@ 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 @@ -27,20 +27,23 @@ */ +#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> #include <qgroupbox.h> #include <qlabel.h> #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 ) { @@ -95,13 +98,12 @@ InstallOptionsDlgImpl::InstallOptionsDlgImpl( int flags, int verb, QWidget * par // if ( flags & MAKE_LINKS ) // makeLinks->setChecked( true ); - showMaximized(); + QPEApplication::showDialog( this ); } InstallOptionsDlgImpl::~InstallOptionsDlgImpl() -{ -} +{} int InstallOptionsDlgImpl :: getFlags() 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 @@ -27,16 +27,27 @@ */ -#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> #include <qfile.h> @@ -52,17 +63,9 @@ #include <qwhatsthis.h> #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 ); @@ -1181,14 +1184,15 @@ void MainWindow :: letterPushed( QString t ) item = (QCheckListItem *)item->nextSibling(); if ( !item ) item = (QCheckListItem *)packagesList->firstChild(); - } while ( item != start); + } + while ( item != start); } 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 ); } QuestionDlg::QuestionDlg( const QString &caption, const QString &text, const QString &secondbtn ) 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 @@ -27,10 +27,18 @@ */ -#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> #include <qlabel.h> @@ -39,16 +47,10 @@ using namespace std; #include <qlistbox.h> #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 ) : QDialog( parent, name, modal, fl ) @@ -78,14 +80,11 @@ SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const SettingsImpl :: ~SettingsImpl() { - } bool SettingsImpl :: showDlg() { - showMaximized(); - exec(); - + QPEApplication::execDialog( this ); if ( changed ) dataMgr->writeOutIpkgConf(); @@ -462,6 +461,7 @@ void SettingsImpl :: changeDestinationDetails() int val = d->linkToRoot(); cfg.writeEntry( key, val ); #endif + } } else @@ -476,6 +476,7 @@ void SettingsImpl :: changeDestinationDetails() key += "_linkToRoot"; 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,11 +1,14 @@ #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> #include <qfileinfo.h> @@ -21,8 +24,8 @@ #include <qregexp.h> #include <qtextstream.h> #include <qtextview.h> -#include <opie2/ostorageinfo.h> +/* STD */ #include <errno.h> #include <stdlib.h> #include <unistd.h> @@ -41,7 +44,6 @@ const QString tempFileName = "/tmp/backup.err"; BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name, WFlags fl) : BackupAndRestoreBase(parent, name, fl) { - this->showMaximized(); backupList->header()->hide(); restoreList->header()->hide(); connect(backupButton, SIGNAL(clicked()), @@ -130,6 +132,7 @@ BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name, WFlags f } } } + QPEApplication::showWidget( this ); } BackupAndRestore::~BackupAndRestore() @@ -287,8 +290,7 @@ void BackupAndRestore::backup() { pErrDialog->m_textarea->setText( "Unable to open File: /tmp/backup.er" ); } - pErrDialog->showMaximized(); - pErrDialog->exec(); + QPEApplication::execDialog( pErrDialog ); delete pErrDialog; break; } @@ -452,8 +454,7 @@ 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; setCaption(tr("Backup and Restore.. Failed !!")); 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 @@ -24,25 +24,31 @@ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#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> #include <qtabdialog.h> #include <qwhatsthis.h> #include <qmessagebox.h> - #include <qapplication.h> #include <qbuttongroup.h> #include <qmessagebox.h> #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); @@ -191,8 +197,7 @@ int DevicesWidget::doTab(){ bool ok = false; while (!ok){ - dlg->showMaximized(); - result = dlg->exec(); + result = QPEApplication::execDialog( dlg ); ok = true; if(result == QDialog::Accepted) { 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 @@ -23,8 +23,16 @@ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#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> #include <qwhatsthis.h> @@ -34,12 +42,11 @@ #include <qvgroupbox.h> #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 , const char *name ) @@ -112,19 +119,23 @@ DialWidget::DialWidget( PPPData *pd, QWidget *parent, bool isnewaccount tl->addMultiCellWidget(pppdargs, 5, 5, 0, 1, AlignCenter); // Set defaults if editing an existing connection - if(!isnewaccount) { + if(!isnewaccount) + { connectname_l->setText(_pppdata->accname()); // insert the phone numbers into the listbox QString n = _pppdata->phonenumber(); 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++; } @@ -137,16 +148,21 @@ DialWidget::DialWidget( PPPData *pd, QWidget *parent, bool isnewaccount tl->activate(); } -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 += ":"; number += numbers->text(i); @@ -158,7 +174,8 @@ bool DialWidget::save() { } -void DialWidget::numbersChanged() { +void DialWidget::numbersChanged() +{ int sel = numbers->currentItem(); del->setEnabled(sel != -1); @@ -167,31 +184,38 @@ 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(); } } -void DialWidget::delNumber() { - if(numbers->currentItem() != -1) { +void DialWidget::delNumber() +{ + if(numbers->currentItem() != -1) + { numbers->removeItem(numbers->currentItem()); numbersChanged(); } } -void DialWidget::upNumber() { +void DialWidget::upNumber() +{ int idx = numbers->currentItem(); - if(idx != -1) { + if(idx != -1) + { QString item = numbers->text(idx); numbers->removeItem(idx); numbers->insertItem(item, idx-1); @@ -201,9 +225,11 @@ 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); numbers->insertItem(item, idx+1); @@ -213,10 +239,10 @@ void DialWidget::downNumber() { } -void DialWidget::pppdargsbutton() { +void DialWidget::pppdargsbutton() +{ PPPdArguments pa(_pppdata, this); - pa.showMaximized(); - pa.exec(); + QPEApplication::execDialog( &pa ); } @@ -305,7 +331,8 @@ ExecWidget::ExecWidget(PPPData *pd, QWidget *parent, bool isnewaccount, const ch tl->activate(); // Set defaults if editing an existing connection - if(!isnewaccount) { + if(!isnewaccount) + { before_connect->setText(_pppdata->command_before_connect()); command->setText(_pppdata->command_on_connect()); discommand->setText(_pppdata->command_on_disconnect()); @@ -314,7 +341,8 @@ 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()); _pppdata->setCommand_before_disconnect(predisconnect->text()); @@ -414,32 +442,38 @@ IPWidget::IPWidget( PPPData *pd, QWidget *parent, bool isnewaccount, const char topLayout->addStretch(); //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()); staticadd_rb->setChecked(true); autoname->setChecked(false); } } - else { + else + { dynamicadd_rb->setChecked(true); hitIPSelect(0); } } -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 " "problems with the X-server and applications " @@ -454,11 +488,15 @@ 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()); } @@ -466,14 +504,17 @@ 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); ipaddress_l->setEnabled(false); subnetmask_l->setEnabled(false); } - else { + else + { ipaddress_label->setEnabled(true); sub_label->setEnabled(true); ipaddress_l->setEnabled(true); @@ -597,7 +638,8 @@ 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()); } @@ -609,16 +651,19 @@ DNSWidget::DNSWidget( PPPData *pd, QWidget *parent, bool isnewaccount, const cha tl->activate(); } -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); servers_label->setEnabled(on); @@ -631,7 +676,8 @@ void DNSWidget::DNS_Mode_Selected(int mode) { dnsservers->triggerUpdate(false); } -void DNSWidget::save() { +void DNSWidget::save() +{ _pppdata->setAutoDNS(bg->id(bg->selected()) == 0); QStringList serverlist; for(uint i=0; i < dnsservers->count(); i++) @@ -649,15 +695,18 @@ 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(""); } } -void DNSWidget::removedns() { +void DNSWidget::removedns() +{ int i; i = dnsservers->currentItem(); if(i != -1) @@ -721,37 +770,45 @@ GatewayWidget::GatewayWidget( PPPData *pd, QWidget *parent, bool isnewaccount, c topLayout->addStretch(); //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); } defaultroute->setChecked(_pppdata->defaultroute()); } - else { + else + { defaultgateway->setChecked(true); hitGatewaySelect(0); defaultroute->setChecked(true); } } -void GatewayWidget::save() { +void GatewayWidget::save() +{ _pppdata->setGateway(gatewayaddr->text()); _pppdata->setDefaultroute(defaultroute->isChecked()); } -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(""); gate_label->setEnabled(true); @@ -803,7 +860,8 @@ ScriptWidget::ScriptWidget( PPPData *pd, QWidget *parent, bool isnewaccount, con l12->addWidget(slb, 0); //load data from gpppdata - if(!isnewaccount) { + if(!isnewaccount) + { QStringList &comlist = _pppdata->scriptType(); QStringList &arglist = _pppdata->script(); QStringList::Iterator itcom = comlist.begin(); @@ -824,17 +882,22 @@ ScriptWidget::ScriptWidget( PPPData *pd, QWidget *parent, bool isnewaccount, con tl->activate(); } -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++; } if ( lend > lstart ) errcnt++; @@ -845,9 +908,11 @@ 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)); } @@ -857,7 +922,8 @@ void ScriptWidget::save() { -void ScriptWidget::adjustScrollBar() { +void ScriptWidget::adjustScrollBar() +{ if((int)sl->count() <= sl->numItemsVisible()) slb->setRange(0, 0); else @@ -865,32 +931,37 @@ void ScriptWidget::adjustScrollBar() { } -void ScriptWidget::scrolling(int i) { +void ScriptWidget::scrolling(int i) +{ sl->setTopItem(i); stl->setTopItem(i); } -void ScriptWidget::slhighlighted(int i) { +void ScriptWidget::slhighlighted(int i) +{ insert->setEnabled(true); remove->setEnabled(true); stl->setCurrentItem(i); } -void ScriptWidget::stlhighlighted(int i) { +void ScriptWidget::stlhighlighted(int i) +{ insert->setEnabled(true); remove->setEnabled(true); sl->setCurrentItem(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"); sl->insertItem(se->text()); @@ -980,13 +1051,15 @@ 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 if(sl->currentItem() < 0 || (sl->count() == MAX_SCRIPT_ENTRIES-1)) return; - switch(se->type()) { + switch(se->type()) + { case ScriptEdit::Expect: stl->insertItem("Expect", stl->currentItem()); sl->insertItem(se->text(), sl->currentItem()); @@ -1070,8 +1143,10 @@ 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()); stl->removeItem(stlc); @@ -1119,14 +1194,16 @@ PhoneNumberDialog::PhoneNumberDialog(QWidget *parent) } -QString PhoneNumberDialog::phoneNumber() { +QString PhoneNumberDialog::phoneNumber() +{ QString s = le->text(); return s; } -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 @@ -19,17 +19,19 @@ ** **********************************************************************/ +#include "modulesinfo.h" +#include "detail.h" + +/* OPIE */ #include <qpe/qpeapplication.h> +/* QT */ #include <qfile.h> #include <qlayout.h> #include <qmessagebox.h> #include <qtimer.h> #include <qwhatsthis.h> -#include "modulesinfo.h" -#include "detail.h" - ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl ) : QWidget( parent, name, fl ) { @@ -82,8 +84,7 @@ ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl ) } ModulesInfo::~ModulesInfo() -{ -} +{} void ModulesInfo::updateData() { @@ -106,7 +107,8 @@ void ModulesInfo::updateData() { QListViewItem *newitem; QListViewItem *selecteditem = 0x0; - while ( true ) { + while ( true ) + { modname[0] = '\0'; usage[0] = '\0'; int success = fscanf( procfile, "%s%d%d%[^\n]", modname, &modsize, &usecount, usage ); @@ -183,6 +185,6 @@ void ModulesInfo::viewModules( QListViewItem *modules ) pclose( modinfo ); } - 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 @@ -17,20 +17,23 @@ ** **********************************************************************/ +#include "processinfo.h" +#include "detail.h" + +/* OPIE */ #include <qpe/qpeapplication.h> +/* QT */ #include <qdir.h> #include <qlayout.h> #include <qmessagebox.h> #include <qtimer.h> #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 ) { @@ -86,8 +89,7 @@ ProcessInfo::ProcessInfo( QWidget* parent, const char* name, WFlags fl ) } ProcessInfo::~ProcessInfo() -{ -} +{} void ProcessInfo::updateData() { @@ -196,5 +198,5 @@ 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 @@ -8,20 +8,25 @@ ***************************************************************************/ #include "userdialog.h" +#include "passwd.h" + +/* OPIE */ +#include <opie/odevice.h> +#include <qpe/qpeapplication.h> +/* QT */ #include <qlayout.h> #include <qlabel.h> #include <qmessagebox.h> #include <qfile.h> +/* STD */ #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> #include <signal.h> -#include "passwd.h" -#include <opie/odevice.h> using namespace Opie; @@ -29,7 +34,8 @@ using namespace Opie; * UserDialog constructor. Setup the dialog, fill the groupComboBox & groupsListView with all groups. * */ -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); myTabWidget=new QTabWidget(this,"User Tab Widget"); @@ -39,28 +45,31 @@ 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 ); } /** * Empty destructor. * */ -UserDialog::~UserDialog() { -} +UserDialog::~UserDialog() +{} /** * Creates the first tab, all userinfo is here. * */ -void UserDialog::setupTab1() { +void UserDialog::setupTab1() +{ QPixmap mypixmap; QWidget *tabpage = new QWidget(myTabWidget,"page1"); QVBoxLayout *layout = new QVBoxLayout(tabpage); @@ -109,7 +118,8 @@ void UserDialog::setupTab1() { groupLabel->setText("Primary group: "); groupComboBox=new QComboBox(tabpage,"PrimaryGroup"); - if(vm==VIEWMODE_NEW) { + if(vm==VIEWMODE_NEW) + { // Copy /etc/skel skelLabel=new QLabel(tabpage,"skel"); skelLabel->setText("Copy /etc/skel: "); @@ -136,7 +146,8 @@ void UserDialog::setupTab1() { vlayout1->addWidget(shellLabel); vlayout1->addSpacing(5); vlayout1->addWidget(groupLabel); - if(vm==VIEWMODE_NEW) { + if(vm==VIEWMODE_NEW) + { vlayout1->addSpacing(5); vlayout1->addWidget(skelLabel); } @@ -152,7 +163,8 @@ void UserDialog::setupTab1() { vlayout2->addWidget(shellComboBox); vlayout2->addSpacing(5); vlayout2->addWidget(groupComboBox); - if(vm==VIEWMODE_NEW) { + if(vm==VIEWMODE_NEW) + { vlayout2->addSpacing(5); vlayout2->addWidget(skelCheckBox); } @@ -166,7 +178,8 @@ void UserDialog::setupTab1() { * Creates the second tab containing additional groups for the user. * */ -void UserDialog::setupTab2() { +void UserDialog::setupTab2() +{ QWidget *tabpage = new QWidget(myTabWidget,"page2"); QVBoxLayout *layout = new QVBoxLayout(tabpage); layout->setMargin(5); @@ -195,7 +208,8 @@ void UserDialog::setupTab2() { * @return <code>true</code> if the user was successfully added, otherwise <code>false</code>. * */ -bool UserDialog::addUser(int uid, int gid) { +bool UserDialog::addUser(int uid, int gid) +{ QCheckListItem *temp; QFile ozTest; int oz=false; @@ -209,9 +223,11 @@ bool UserDialog::addUser(int uid, int gid) { adduserDialog->groupComboBox->insertItem("<create new group>",0); 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); if (temp->text()=="audio") temp->setOn(true); @@ -224,29 +240,34 @@ 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; qWarning(QString::number(accounts->gr_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; } // Add User to additional groups. QListViewItemIterator it( adduserDialog->groupsListView ); - for ( ; it.current(); ++it ) { + for ( ; it.current(); ++it ) + { temp=(QCheckListItem*)it.current(); if (temp->isOn() ) accounts->addGroupMember(it.current()->text(0),adduserDialog->loginLineEdit->text()); } // 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"); } QString filename="/opt/QtPalmtop/pics/users/"+accounts->pw_name+".png"; @@ -256,7 +277,8 @@ 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; command_cp.sprintf("cp -a /etc/skel/* %s/",accounts->pw_dir.latin1()); @@ -280,12 +302,17 @@ bool UserDialog::addUser(int uid, int gid) { * @return <code>true</code> if the user was successfully deleted, otherwise <code>false</code>. * */ -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; } @@ -301,13 +328,15 @@ bool UserDialog::delUser(const char *username) { * @return <code>true</code> if the user was successfully deleted, otherwise <code>false</code>. * */ -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. UserDialog *edituserDialog=new UserDialog(VIEWMODE_EDIT); // Create Dialog 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; } // Fill widgets with userinfo. @@ -317,18 +346,22 @@ bool UserDialog::editUser(const char *username) { // Set password to '........', we will later check if this still is the contents, if not, the password has been changed. 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); } @@ -338,11 +371,14 @@ bool UserDialog::editUser(const char *username) { // BAH!!! QRegExp in qt2 sucks... or maybe I do... can't figure out how to check for EITHER end of input ($) OR a comma, so here we do two different QRegExps instead. 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.; } @@ -350,11 +386,14 @@ 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.; } @@ -370,7 +409,8 @@ 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. } accounts->pw_gecos=edituserDialog->gecosLineEdit->text(); @@ -379,22 +419,26 @@ bool UserDialog::editUser(const char *username) { accounts->updateUser(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); } // 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() ) accounts->addGroupMember(it.current()->text(0),edituserDialog->loginLineEdit->text()); } // 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"); } QString filename="/opt/QtPalmtop/pics/users/"+accounts->pw_name+".png"; @@ -408,9 +452,11 @@ bool UserDialog::editUser(const char *username) { * "OK" has been clicked. Verify some information before closing the dialog. * */ -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; } @@ -421,13 +467,18 @@ void UserDialog::accept() { * This slot is called when the usericon is clicked, this loads (should) the iconselector. * */ -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; picture=(QPixmap *)picturePushButton->pixmap(); |