summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/appearance2/appearance.cpp162
-rw-r--r--noncore/settings/appearance2/stylelistitem.h8
-rw-r--r--noncore/settings/aqpkg/categoryfilterimpl.cpp20
-rw-r--r--noncore/settings/aqpkg/instoptionsimpl.cpp16
-rw-r--r--noncore/settings/aqpkg/mainwin.cpp38
-rw-r--r--noncore/settings/aqpkg/settingsimpl.cpp35
-rw-r--r--noncore/settings/backup/backuprestore.cpp17
-rw-r--r--noncore/settings/networksettings/ppp/devices.cpp25
-rw-r--r--noncore/settings/networksettings/ppp/edit.cpp233
-rw-r--r--noncore/settings/sysinfo/modulesinfo.cpp16
-rw-r--r--noncore/settings/sysinfo/processinfo.cpp14
-rw-r--r--noncore/settings/usermanager/userdialog.cpp149
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
@@ -22,16 +22,40 @@
 -.   .:....=;==+<; General Public License along with this file;
  -_. . .   )=.  = see the file COPYING. If not, write to the
    --        :-=` Free Software Foundation, Inc.,
59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
+#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>
#include <qdialog.h>
#include <qdir.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qlineedit.h>
@@ -44,55 +68,33 @@
#endif
#include <qtoolbutton.h>
#include <qwindowsstyle.h>
#include <qlistview.h>
#include <qheader.h>
#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;
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;
else if ( uuid == IID_WindowDecoration )
*iface = this;
if ( *iface )
(*iface)->addRef();
@@ -129,29 +131,32 @@ QWidget *Appearance::createStyleTab ( QWidget *parent, Config &cfg )
#if QT_VERSION >= 300
m_style_list->insertStringList(QStyleFactory::styles());
#else
m_style_list-> insertItem ( new StyleListItem ( "Windows", new QWindowsStyle ( )));
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 );
if ( slit-> key ( ) == s )
m_style_list-> setCurrentItem ( slit );
}
else
delete lib;
@@ -179,24 +184,26 @@ QWidget *Appearance::createDecoTab ( QWidget *parent, Config &cfg )
m_deco_list-> insertItem ( new DecoListItem ( "QPE" ));
{
QString path = QPEApplication::qpeDir();
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 );
if ( dlit-> key ( ) == s )
m_deco_list-> setCurrentItem ( dlit );
}
else
delete lib;
@@ -241,17 +248,18 @@ QWidget *Appearance::createColorTab ( QWidget *parent, Config &cfg )
QWhatsThis::add( m_color_list, tr( "Color schemes are a collection of colors which are used for various parts of the display.\n\nClick here to select an available scheme." ) );
m_color_list-> insertItem ( new ColorListItem ( tr( "Current scheme" ), cfg ));
QString path = QPEApplication::qpeDir ( );
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 );
Config config ( pathstr, Config::File );
config. setGroup ( "Colors" );
m_color_list-> insertItem ( new ColorListItem ( name, config ));
}
@@ -343,17 +351,18 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg )
connect ( tb, SIGNAL( clicked ( )), this, SLOT( downExcept ( )));
QWhatsThis::add( tb, tr( "Click here to move the currently selected application down in the list." ) );
lay-> setRowStretch ( 6, 10 );
lay-> setColStretch ( 0, 10 );
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 );
}
vertLayout-> addSpacing ( 3 );
QFrame *f = new QFrame ( tab );
@@ -427,19 +436,22 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg )
rotLay-> addWidget ( rotlabel, 0 );
rotLay-> addWidget ( m_rotdir_cw, 0 );
rotLay-> addWidget ( m_rotdir_ccw, 0 );
rotLay-> addWidget ( m_rotdir_flip, 0 );
int rotDirection = cfg.readNumEntry( "rotatedir" );
ODirection rot = CW;
- if (rotDirection == -1) {
+ if (rotDirection == -1)
+ {
rot = ODevice::inst ( )-> direction ( );
- } else {
+ }
+ else
+ {
rot = (ODirection)rotDirection;
}
m_rotdir_cw-> setChecked ( rot == CW );
m_rotdir_ccw-> setChecked ( rot == CCW );
m_rotdir_flip-> setChecked ( rot == Flip );
return tab;
@@ -477,84 +489,94 @@ Appearance::Appearance( QWidget* parent, const char* name, WFlags )
tw-> setCurrentTab ( styletab );
connect ( tw, SIGNAL( currentChanged ( QWidget * )), this, SLOT( tabChanged ( QWidget * )));
m_style_changed = m_font_changed = m_color_changed = m_deco_changed = false;
}
Appearance::~Appearance()
-{
-}
+{}
void Appearance::tabChanged ( QWidget *w )
{
- if ( w == m_advtab ) {
+ if ( w == m_advtab )
+ {
m_sample-> hide ( );
updateGeometry ( ); // shouldn't be necessary ...
}
else
m_sample-> show ( );
}
void Appearance::accept ( )
{
bool newtabpos = m_tabstyle_top-> isChecked ( );
int newtabstyle = m_tabstyle_list-> currentItem ( );
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 ( ));
}
if ( m_color_changed )
{
ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
if ( item )
item-> save ( config );
}
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 );
m_except-> setFocus ( ); // if the focus was on the embedded line-edit, we have to move it away first, so the contents are updated
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 );
fl |= ( it-> noDeco ( ) ? 0x04 : 0 );
exceptstr = QString::number ( fl, 32 );
exceptstr.append( it-> pattern ( ));
sl << exceptstr;
}
@@ -574,55 +596,58 @@ void Appearance::done ( int r )
}
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 ( ));
}
m_style_changed |= ( index != m_original_style );
}
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;
}
delete d;
}
}
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
m_sample-> setDecoration ( new DefaultWindowDecoration ( ));
m_sample-> repaint ( );
}
m_deco_changed |= ( index != m_original_deco );
}
@@ -647,35 +672,39 @@ void Appearance::colorClicked ( int index )
void Appearance::editSchemeClicked ( )
{
ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
int cnt = 0;
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;
cnt++;
}
}
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++;
}
}
m_color_list-> setCurrentItem ( 0 );
colorClicked ( 0 );
@@ -693,17 +722,18 @@ void Appearance::saveSchemeClicked()
return;
QDialog *d = new QDialog ( this, 0, true );
d-> setCaption ( tr( "Save Scheme" ));
QLineEdit *ed = new QLineEdit ( d );
( 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/" );
filestr.append( schemename );
filestr.append( ".scheme" );
QFile file ( filestr );
if ( !file. exists ( ))
{
@@ -756,17 +786,18 @@ void Appearance::addExcept ( )
{
ExceptListItem *it = new ExceptListItem ( m_except, 0, tr( "<new>" ), true, true, true );
m_except-> ensureItemVisible ( it );
m_except-> setSelected ( it, true );
}
void Appearance::delExcept ( )
{
- if ( m_except-> selectedItem ( )) {
+ if ( m_except-> selectedItem ( ))
+ {
m_except-> setFocus ( );
delete m_except-> selectedItem ( );
}
}
void Appearance::upExcept ( )
{
ExceptListItem *it = (ExceptListItem *) m_except-> selectedItem ( );
@@ -778,17 +809,18 @@ void Appearance::upExcept ( )
void Appearance::downExcept ( )
{
ExceptListItem *it = (ExceptListItem *) m_except-> selectedItem ( );
if ( it && it-> itemBelow ( ))
it-> moveItem ( it-> itemBelow ( ));
}
-class ExEdit : public QLineEdit {
+class ExEdit : public QLineEdit
+{
public:
ExEdit ( ExceptListItem *item )
: QLineEdit ( item-> listView ( )-> viewport ( ), "exedit" ), it ( item )
{
setFrame ( false );
QRect r = it-> listView ( )-> itemRect ( it );
@@ -817,17 +849,18 @@ public:
it-> setPattern ( text ( ));
delete this;
}
virtual void keyPressEvent ( QKeyEvent *e )
{
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 ( );
}
else
QLineEdit::keyPressEvent ( e );
}
private:
@@ -843,14 +876,15 @@ void Appearance::clickedExcept ( QListViewItem *item, const QPoint &, int c )
ExceptListItem *it = (ExceptListItem *) item;
if ( c == 0 )
it-> setNoStyle ( !it-> noStyle ( ));
else if ( c == 1 )
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
@@ -23,18 +23,24 @@
59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#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>
class StyleListItem : public QListBoxText {
public:
StyleListItem ( const QString &t, QStyle *sty ) : QListBoxText ( t )
{
m_lib = 0;
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
@@ -22,25 +22,31 @@
 -.   .:....=;==+<; General Public License along with this file;
  -_. . .   )=.  = see the file COPYING. If not, write to the
    --        :-=` Free Software Foundation, Inc.,
59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-#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 )
{
setCaption( tr( "Category Filter" ) );
QVBoxLayout *layout = new QVBoxLayout( this );
layout->setMargin( 2 );
@@ -71,26 +77,26 @@ CategoryFilterImpl :: CategoryFilterImpl(const QString &categories, const QStrin
{
lstCategories->insertItem( item );
finditem = QString( "#%1#" ).arg( item );
if ( selectedCategories.find( finditem ) != -1 )
lstCategories->setSelected( lstCategories->count()-1, true );
}
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()
{
// Grab cetegories from listbox
QString ret = "#";
for ( int i = 0 ; i < (int)lstCategories->count() ; ++i )
{
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
@@ -22,30 +22,33 @@
 -.   .:....=;==+<; General Public License along with this file;
  -_. . .   )=.  = see the file COPYING. If not, write to the
    --        :-=` Free Software Foundation, Inc.,
59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
+#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 )
{
setCaption( tr( "Options" ) );
QVBoxLayout *layout = new QVBoxLayout( this );
layout->setMargin( 2 );
layout->setSpacing( 4 );
@@ -90,23 +93,22 @@ InstallOptionsDlgImpl::InstallOptionsDlgImpl( int flags, int verb, QWidget * par
forceRemove->setChecked( true );
if ( flags & FORCE_OVERWRITE )
forceOverwrite->setChecked( true );
// if ( flags & VERBOSE_WGET )
// verboseWget->setChecked( true );
// if ( flags & MAKE_LINKS )
// makeLinks->setChecked( true );
- showMaximized();
+ QPEApplication::showDialog( this );
}
InstallOptionsDlgImpl::~InstallOptionsDlgImpl()
-{
-}
+{}
int InstallOptionsDlgImpl :: getFlags()
{
int flags = 0;
if ( forceDepends->isChecked() )
flags |= FORCE_DEPENDS;
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
@@ -22,52 +22,55 @@
 -.   .:....=;==+<; General Public License along with this file;
  -_. . .   )=.  = see the file COPYING. If not, write to the
    --        :-=` Free Software Foundation, Inc.,
59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-#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>
#include <qlabel.h>
#include <qlayout.h>
#include <qlineedit.h>
#include <qlistview.h>
#include <qmenubar.h>
#include <qmessagebox.h>
#include <qpopupmenu.h>
#include <qprogressbar.h>
#include <qtimer.h>
#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 );
MainWindow :: MainWindow( QWidget* parent, const char* name, WFlags fl )
: QMainWindow( parent, name, fl || WStyle_ContextHelp )
{
// Disable suspend mode
QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::DisableSuspend;
@@ -1176,24 +1179,25 @@ void MainWindow :: letterPushed( QString t )
packagesList->setSelected( item, true );
packagesList->ensureItemVisible( item );
break;
}
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 )
: QWidget( 0x0, 0x0, WType_Modal | WType_TopLevel | WStyle_Dialog )
{
setCaption( caption );
resize( 175, 100 );
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
@@ -22,38 +22,40 @@
 -.   .:....=;==+<; General Public License along with this file;
  -_. . .   )=.  = see the file COPYING. If not, write to the
    --        :-=` Free Software Foundation, Inc.,
59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-#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>
#include <qlayout.h>
#include <qlineedit.h>
#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 )
{
setCaption( tr( "Configuration" ) );
// Setup layout to make everything pretty
QVBoxLayout *layout = new QVBoxLayout( this );
@@ -73,24 +75,21 @@ SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const
setupData();
changed = false;
newserver = false;
newdestination = false;
}
SettingsImpl :: ~SettingsImpl()
{
-
}
bool SettingsImpl :: showDlg()
{
- showMaximized();
- exec();
-
+ QPEApplication::execDialog( this );
if ( changed )
dataMgr->writeOutIpkgConf();
return changed;
}
QWidget *SettingsImpl :: initServerTab()
{
@@ -457,30 +456,32 @@ void SettingsImpl :: changeDestinationDetails()
}
#ifdef QWS
QString key = newName;
key += "_linkToRoot";
int val = d->linkToRoot();
cfg.writeEntry( key, val );
#endif
+
}
}
else
{
dataMgr->getDestinationList().append( new Destination( newName, destinationurl->text() ) );
destinations->insertItem( newName );
destinations->setCurrentItem( destinations->count() );
newdestination = false;
#ifdef QWS
QString key = newName;
key += "_linkToRoot";
cfg.writeEntry( key, true );
#endif
+
}
}
//------------------ Proxy tab ----------------------
void SettingsImpl :: proxyApplyChanges()
{
changed = true;
dataMgr->setHttpProxy( txtHttpProxy->text() );
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,33 +1,36 @@
#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>
#include <qlistview.h>
#include <qpushbutton.h>
#include <qheader.h>
#include <qpe/resource.h>
#include <qpe/config.h>
#include <qmessagebox.h>
#include <qcombobox.h>
#include <qlist.h>
#include <stdlib.h>
#include <qregexp.h>
#include <qtextstream.h>
#include <qtextview.h>
-#include <opie2/ostorageinfo.h>
+/* STD */
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include <dirent.h>
#define HEADER_NAME 0
#define HEADER_BACKUP 1
@@ -36,17 +39,16 @@
#define EXTENSION ".bck"
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()),
this, SLOT(backup()));
connect(restoreButton, SIGNAL(clicked()),
this, SLOT(restore()));
connect(backupList, SIGNAL(clicked( QListViewItem * )),
this, SLOT(selectItem(QListViewItem*)));
@@ -125,16 +127,17 @@ BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name, WFlags f
{
if(*dontBackupList.at(i2) == text)
{
selectItem(list.at(i));
break;
}
}
}
+ QPEApplication::showWidget( this );
}
BackupAndRestore::~BackupAndRestore()
{
QList<QListViewItem> list;
getAllItems(backupList->firstChild(), list);
Config config("BackupAndRestore");
@@ -282,18 +285,17 @@ void BackupAndRestore::backup()
errorFile.close();
pErrDialog->m_textarea->setText( s );
}
else
{
pErrDialog->m_textarea->setText( "Unable to open File: /tmp/backup.er" );
}
- pErrDialog->showMaximized();
- pErrDialog->exec();
+ QPEApplication::execDialog( pErrDialog );
delete pErrDialog;
break;
}
setCaption(tr("Backup and Restore.. Failed !!"));
return;
}
else
{
@@ -447,18 +449,17 @@ void BackupAndRestore::restore()
errorFile.close();
pErrDialog->m_textarea->setText( s );
}
else
{
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 !!"));
return;
break;
}
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
@@ -19,35 +19,41 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the Free
* 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);
DevicesWidget::DevicesWidget( InterfacePPP* ip, QWidget *parent, const char *name, WFlags f )
: ChooserWidget(ip->data(), parent, name, f)
{
_ifaceppp = ip;
QWhatsThis::add(edit_b, tr("Allows you to modify the selected device"));
@@ -186,18 +192,17 @@ int DevicesWidget::doTab(){
tabWindow->addTab( modem1, tr("&Device") );
modem2 = new ModemWidget2( _pppdata, _ifaceppp, tabWindow, "modem2" );
tabWindow->addTab( modem2, tr("&Modem") );
int result = 0;
bool ok = false;
while (!ok){
- dlg->showMaximized();
- result = dlg->exec();
+ result = QPEApplication::execDialog( dlg );
ok = true;
if(result == QDialog::Accepted) {
if (!modem1->save()){
QMessageBox::critical(this, "error", tr( "You must enter a unique device name"));
ok = false;
}else{
modem2->save();
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
@@ -18,33 +18,40 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the Free
* 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>
#include <qregexp.h>
#include <qapplication.h>
#include <qbuttongroup.h>
#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 )
: QWidget(parent, name), _pppdata(pd)
{
const int GRIDROWS = 6;
QGridLayout *tl = new QGridLayout(this, GRIDROWS, 2, 0 );
@@ -107,121 +114,140 @@ DialWidget::DialWidget( PPPData *pd, QWidget *parent, bool isnewaccount
QWhatsThis::add(number_label,tmp);
QWhatsThis::add(numbers,tmp);
pppdargs = new QPushButton(tr("Customize pppd Arguments..."), this);
connect(pppdargs, SIGNAL(clicked()), SLOT(pppdargsbutton()));
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++;
}
if(tmp.length() > 0)
numbers->insertItem(tmp);
}
numbersChanged();
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);
}
_pppdata->setPhonenumber(number);
return true;
}
}
-void DialWidget::numbersChanged() {
+void DialWidget::numbersChanged()
+{
int sel = numbers->currentItem();
del->setEnabled(sel != -1);
up->setEnabled(sel != -1 && sel != 0);
down->setEnabled(sel != -1 && sel != (int)numbers->count()-1);
}
-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);
numbers->setCurrentItem(idx-1);
numbersChanged();
}
}
-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);
numbers->setCurrentItem(idx+1);
numbersChanged();
}
}
-void DialWidget::pppdargsbutton() {
+void DialWidget::pppdargsbutton()
+{
PPPdArguments pa(_pppdata, this);
- pa.showMaximized();
- pa.exec();
+ QPEApplication::execDialog( &pa );
}
/////////////////////////////////////////////////////////////////////////////
// ExecWidget
/////////////////////////////////////////////////////////////////////////////
ExecWidget::ExecWidget(PPPData *pd, QWidget *parent, bool isnewaccount, const char *name) :
@@ -300,26 +326,28 @@ ExecWidget::ExecWidget(PPPData *pd, QWidget *parent, bool isnewaccount, const ch
// extra space between entries
l1->addRowSpacing(1, 5);
l1->addRowSpacing(3, 5);
tl->addStretch(1);
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());
predisconnect->setText(_pppdata->command_before_disconnect());
}
}
-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());
_pppdata->setCommand_on_disconnect(discommand->text());
return true;
}
@@ -409,76 +437,89 @@ IPWidget::IPWidget( PPPData *pd, QWidget *parent, bool isnewaccount, const char
"\n"
"Don't enable this unless you really need it."));
topLayout->addWidget(box);
topLayout->addWidget(autoname);
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 "
"while kppp is connected. Don't use it until "
"you know what you are doing!\n"
"For more information take a look at the "
"handbook (or help) in the section \"Frequently "
"asked questions\"."),
tr("Warning"));
was_warned = true;
}
}
-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());
}
_pppdata->setAutoname(autoname->isChecked());
}
-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);
subnetmask_l->setEnabled(true);
}
}
@@ -592,51 +633,56 @@ DNSWidget::DNSWidget( PPPData *pd, QWidget *parent, bool isnewaccount, const cha
"closed, the servers will be re-enabled\n"
"\n"
"Typically, there is no reason to use this\n"
"option, but it may become useful under \n"
"some circumstances."));
// restore data if editing
- if(!isnewaccount) {
+ if(!isnewaccount)
+ {
dnsservers->insertStringList(_pppdata->dns());
dnsdomain->setText(_pppdata->domain());
}
int mode = _pppdata->autoDNS() ? 0 : 1;
bg->setButton(mode);
DNS_Mode_Selected(mode);
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);
dnsipaddr->setText("");
dnsipaddr->setEnabled(on);
add->setEnabled(false);
remove->setEnabled(dnsservers->count()>0 && on);
dnsservers->clearSelection();
dnsservers->setEnabled(on);
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++)
serverlist.append(dnsservers->text(i));
_pppdata->setDns(serverlist);
// strip leading dot
QString s(dnsdomain->text());
@@ -644,25 +690,28 @@ void DNSWidget::save() {
_pppdata->setDomain(s.mid(1));
else
_pppdata->setDomain(dnsdomain->text());
_pppdata->setExDNSDisabled(exdnsdisabled_toggle->isChecked());
}
-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)
dnsservers->removeItem(i);
remove->setEnabled(dnsservers->count()>0);
}
@@ -716,47 +765,55 @@ GatewayWidget::GatewayWidget( PPPData *pd, QWidget *parent, bool isnewaccount, c
"\n"
"Normally, you should turn this on"));
topLayout->addWidget(box);
topLayout->addWidget(defaultroute);
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);
}
}
@@ -798,17 +855,18 @@ ScriptWidget::ScriptWidget( PPPData *pd, QWidget *parent, bool isnewaccount, con
// slb->setFixedWidth(slb->sizeHint().width());
connect(slb, SIGNAL(valueChanged(int)), SLOT(scrolling(int)));
l12->addWidget(stl, 1);
l12->addWidget(sl, 3);
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();
QStringList::Iterator itarg = arglist.begin();
for ( ;
itcom != comlist.end() && itarg != arglist.end();
++itcom, ++itarg )
@@ -819,83 +877,96 @@ ScriptWidget::ScriptWidget( PPPData *pd, QWidget *parent, bool isnewaccount, con
}
insert->setEnabled(false);
remove->setEnabled(false);
adjustScrollBar();
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++;
}
return ( (errcnt == 0 ) && (lstart == lend) );
}
return true;
}
-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));
}
_pppdata->setScriptType(typelist);
_pppdata->setScript(arglist);
}
-void ScriptWidget::adjustScrollBar() {
+void ScriptWidget::adjustScrollBar()
+{
if((int)sl->count() <= sl->numItemsVisible())
slb->setRange(0, 0);
else
slb->setRange(0, (sl->count() - sl->numItemsVisible())+1);
}
-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());
break;
case ScriptEdit::Send:
stl->insertItem("Send");
sl->insertItem(se->text());
@@ -975,23 +1046,25 @@ void ScriptWidget::addButton() {
adjustScrollBar();
slb->setValue(slb->maxValue());
//clear the text in the entry box
se->setText("");
}
-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());
break;
case ScriptEdit::Send:
stl->insertItem("Send", stl->currentItem());
sl->insertItem(se->text(), sl->currentItem());
@@ -1065,18 +1138,20 @@ void ScriptWidget::insertButton() {
default:
break;
}
adjustScrollBar();
se->setText("");
}
-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);
adjustScrollBar();
insert->setEnabled(sl->currentItem() != -1);
remove->setEnabled(sl->currentItem() != -1);
}
}
@@ -1114,21 +1189,23 @@ PhoneNumberDialog::PhoneNumberDialog(QWidget *parent)
le->setFocus();
textChanged("");
}
-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);
}
//#include "edit.moc"
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
@@ -14,27 +14,29 @@
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
**********************************************************************/
+#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 )
{
QGridLayout *layout = new QGridLayout( this );
layout->setSpacing( 4 );
layout->setMargin( 4 );
ModulesView = new QListView( this );
@@ -77,18 +79,17 @@ ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl )
updateData();
ModulesDtl = new Detail();
QWhatsThis::add( ModulesDtl->detailView, tr( "This area shows detailed information about this module." ) );
}
ModulesInfo::~ModulesInfo()
-{
-}
+{}
void ModulesInfo::updateData()
{
char modname[64];
char usage[200];
int modsize, usecount;
QString selectedmod;
@@ -101,17 +102,18 @@ void ModulesInfo::updateData()
ModulesView->clear();
FILE *procfile = fopen( ( QString ) ( "/proc/modules"), "r");
if ( procfile )
{
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 );
if ( success == EOF )
break;
QString qmodname = QString( modname );
@@ -178,11 +180,11 @@ void ModulesInfo::viewModules( QListViewItem *modules )
if ( success == EOF )
break;
ModulesDtl->detailView->append( line );
}
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
@@ -12,30 +12,33 @@
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
**********************************************************************/
+#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 )
{
QGridLayout *layout = new QGridLayout( this );
layout->setSpacing( 4 );
layout->setMargin( 4 );
@@ -81,18 +84,17 @@ ProcessInfo::ProcessInfo( QWidget* parent, const char* name, WFlags fl )
updateData();
ProcessDtl = new Detail();
QWhatsThis::add( ProcessDtl->detailView, tr( "This area shows detailed information about this process." ) );
}
ProcessInfo::~ProcessInfo()
-{
-}
+{}
void ProcessInfo::updateData()
{
int pid, ppid, pgrp, session, tty, tpgid, utime, stime, cutime, cstime, counter, priority, starttime,
signal, blocked, sigignore, sigcatch;
uint flags, minflt, cminflt, majflt, cmajflt, timeout, itrealvalue, vsize, rss, rlim, startcode,
endcode, startstack, kstkesp, kstkeip, wchan;
char state;
@@ -191,10 +193,10 @@ void ProcessInfo::viewProcess( QListViewItem *process )
fgets( line, 81, statfile );
ProcessDtl->detailView->setText( line );
while ( fgets( line, 81, statfile ) )
{
ProcessDtl->detailView->append( line );
}
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
@@ -3,69 +3,78 @@
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#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;
/**
* 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");
layout->addWidget(myTabWidget);
setupTab1();
setupTab2();
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);
layout->setMargin(5);
// Picture
picturePushButton = new QPushButton(tabpage,"Label");
picturePushButton->setMinimumSize(48,48);
@@ -104,17 +113,18 @@ void UserDialog::setupTab1() {
shellComboBox->insertItem("/bin/ash");
shellComboBox->insertItem("/bin/false");
// Primary Group
QLabel *groupLabel=new QLabel(tabpage,"group");
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: ");
skelCheckBox=new QCheckBox(tabpage);
skelCheckBox->setChecked(true);
}
// Widget layout
@@ -131,47 +141,50 @@ void UserDialog::setupTab1() {
vlayout1->addSpacing(5);
vlayout1->addWidget(gecosLabel);
vlayout1->addSpacing(5);
vlayout1->addWidget(passwordLabel);
vlayout1->addSpacing(5);
vlayout1->addWidget(shellLabel);
vlayout1->addSpacing(5);
vlayout1->addWidget(groupLabel);
- if(vm==VIEWMODE_NEW) {
+ if(vm==VIEWMODE_NEW)
+ {
vlayout1->addSpacing(5);
vlayout1->addWidget(skelLabel);
}
// Second column, data
vlayout2->addWidget(loginLineEdit);
vlayout2->addSpacing(5);
vlayout2->addWidget(uidLineEdit);
vlayout2->addSpacing(5);
vlayout2->addWidget(gecosLineEdit);
vlayout2->addSpacing(5);
vlayout2->addWidget(passwordLineEdit);
vlayout2->addSpacing(5);
vlayout2->addWidget(shellComboBox);
vlayout2->addSpacing(5);
vlayout2->addWidget(groupComboBox);
- if(vm==VIEWMODE_NEW) {
+ if(vm==VIEWMODE_NEW)
+ {
vlayout2->addSpacing(5);
vlayout2->addWidget(skelCheckBox);
}
hlayout->addLayout(vlayout1);
hlayout->addLayout(vlayout2);
myTabWidget->addTab(tabpage,"User Info");
}
/**
* 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);
// Additional groups
groupsListView=new QListView(tabpage,"groups");
groupsListView->addColumn("Additional groups");
groupsListView->setColumnWidthMode(0,QListView::Maximum);
@@ -190,78 +203,87 @@ void UserDialog::setupTab2() {
* The user will be prompted to add a user.
*
* @param uid This is a suggested available UID.
* @param gid This is a suggested available GID.
*
* @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;
if(ODevice::inst()->system()==System_OpenZaurus) oz=true;
// viewmode is a workaround for a bug in qte-2.3.4 that gives bus error on manipulating adduserDialog's widgets here.
UserDialog *adduserDialog=new UserDialog(VIEWMODE_NEW);
adduserDialog->setCaption(tr("Add User"));
adduserDialog->userID=uid; // Set next available UID as default uid.
adduserDialog->groupID=gid; // Set next available GID as default gid.
// Insert default group into groupComboBox
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);
if (temp->text()=="time") temp->setOn(true);
if (temp->text()=="power") temp->setOn(true);
if (temp->text()=="input") temp->setOn(true);
if (temp->text()=="sharp") temp->setOn(true);
if (temp->text()=="tty") temp->setOn(true);
}
}
// 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";
// adduserDialog->userImage=adduserDialog->userImage.smoothScale(48,48);
adduserDialog->userImage.save(filename,"PNG");
}
// 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());
system(command_cp);
command_cp.sprintf("cp -a /etc/skel/.[!.]* %s/",accounts->pw_dir.latin1()); // Bug in busybox, ".*" includes parent directory, does this work as a workaround?
system(command_cp);
@@ -275,164 +297,193 @@ bool UserDialog::addUser(int uid, int gid) {
/**
* Deletes the user account.
*
* @param username User to be deleted.
*
* @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;
}
return true;
}
/**
* This displays a confirmation dialog wether a user should be deleted or not.
* (And also deletes the account)
*
* @param username User to be deleted.
*
* @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.
edituserDialog->loginLineEdit->setText(accounts->pw_name);
edituserDialog->uidLineEdit->setText(QString::number(accounts->pw_uid));
edituserDialog->gecosLineEdit->setText(accounts->pw_gecos);
// 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);
}
// Select the groups in the listview, to which the user belongs.
QCheckListItem *temp;
// 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.;
}
}
}
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.;
}
}
}
if(!(edituserDialog->exec())) return false; // SHOW THE DIALOG!
accounts->findUser(username); // Fill user variables in 'acccounts' object.
accounts->pw_name=edituserDialog->loginLineEdit->text();
// Has the password been changed ? Make a new "crypt":ed password.
if(edituserDialog->passwordLineEdit->text()!="........") accounts->pw_passwd=crypt(edituserDialog->passwordLineEdit->text(), accounts->crypt_make_salt());
// 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();
accounts->pw_shell=edituserDialog->shellComboBox->currentText();
// Update userinfo, using the information stored in the user variables stored in the accounts object.
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";
// edituserDialog->userImage=edituserDialog->userImage.smoothScale(48,48);
edituserDialog->userImage.save(filename,"PNG");
}
return true;
}
/**
* "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;
}
QDialog::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();
picture->convertFromImage(userImage,0);
picturePushButton->update();
}
}
}