summaryrefslogtreecommitdiff
path: root/noncore
authorar <ar>2004-02-21 16:02:01 (UTC)
committer ar <ar>2004-02-21 16:02:01 (UTC)
commitdb2afda83e495bff9fc19fa14a30072f1cd4c67a (patch) (side-by-side diff)
tree0281ec10dad24d83179283370661ae9225016de0 /noncore
parent460258f203be746ff79e14f32a823f381b8ea513 (diff)
downloadopie-db2afda83e495bff9fc19fa14a30072f1cd4c67a.zip
opie-db2afda83e495bff9fc19fa14a30072f1cd4c67a.tar.gz
opie-db2afda83e495bff9fc19fa14a30072f1cd4c67a.tar.bz2
improve support for BigScreen
Diffstat (limited to 'noncore') (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
@@ -24,12 +24,36 @@
    --        :-=` 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>
@@ -46,51 +70,29 @@
#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;
@@ -131,25 +133,28 @@ QWidget *Appearance::createStyleTab ( QWidget *parent, Config &cfg )
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 );
}
@@ -181,20 +186,22 @@ QWidget *Appearance::createDecoTab ( QWidget *parent, Config &cfg )
{
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 );
}
@@ -243,13 +250,14 @@ QWidget *Appearance::createColorTab ( QWidget *parent, Config &cfg )
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" );
@@ -345,13 +353,14 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg )
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 );
}
@@ -429,15 +438,18 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg )
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 );
@@ -479,18 +491,18 @@ Appearance::Appearance( QWidget* parent, const char* name, WFlags )
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 ( );
}
@@ -500,30 +512,34 @@ 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 ( ));
}
@@ -533,26 +549,32 @@ void Appearance::accept ( )
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 ( ));
@@ -576,51 +598,54 @@ 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 ( );
}
@@ -649,31 +674,35 @@ 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 );
@@ -695,13 +724,14 @@ void Appearance::saveSchemeClicked()
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 );
@@ -758,13 +788,14 @@ void Appearance::addExcept ( )
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 ( )
@@ -780,13 +811,14 @@ 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 );
@@ -819,13 +851,14 @@ public:
}
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 );
}
@@ -845,12 +878,13 @@ void Appearance::clickedExcept ( QListViewItem *item, const QPoint &, int c )
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
@@ -25,14 +25,20 @@
*/
#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 )
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
@@ -24,21 +24,27 @@
    --        :-=` 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" ) );
@@ -73,22 +79,22 @@ CategoryFilterImpl :: CategoryFilterImpl(const QString &categories, const QStrin
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 = "#";
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
@@ -24,26 +24,29 @@
    --        :-=` 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 );
@@ -92,19 +95,18 @@ InstallOptionsDlgImpl::InstallOptionsDlgImpl( int flags, int verb, QWidget * par
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;
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
@@ -24,22 +24,33 @@
    --        :-=` 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>
@@ -49,23 +60,15 @@
#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 )
{
@@ -1178,20 +1181,21 @@ void MainWindow :: letterPushed( QString t )
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 );
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
@@ -24,34 +24,36 @@
    --        :-=` 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" ) );
@@ -75,20 +77,17 @@ SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const
newserver = false;
newdestination = false;
}
SettingsImpl :: ~SettingsImpl()
{
-
}
bool SettingsImpl :: showDlg()
{
- showMaximized();
- exec();
-
+ QPEApplication::execDialog( this );
if ( changed )
dataMgr->writeOutIpkgConf();
return changed;
}
@@ -459,12 +458,13 @@ 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 );
@@ -473,12 +473,13 @@ void SettingsImpl :: changeDestinationDetails()
#ifdef QWS
QString key = newName;
key += "_linkToRoot";
cfg.writeEntry( key, true );
#endif
+
}
}
//------------------ Proxy tab ----------------------
void SettingsImpl :: proxyApplyChanges()
{
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,14 +1,17 @@
#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>
@@ -18,14 +21,14 @@
#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>
@@ -38,13 +41,12 @@
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()));
@@ -127,12 +129,13 @@ BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name, WFlags f
{
selectItem(list.at(i));
break;
}
}
}
+ QPEApplication::showWidget( this );
}
BackupAndRestore::~BackupAndRestore()
{
QList<QListViewItem> list;
getAllItems(backupList->firstChild(), list);
@@ -284,14 +287,13 @@ void BackupAndRestore::backup()
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;
}
@@ -449,14 +451,13 @@ void BackupAndRestore::restore()
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
@@ -21,31 +21,37 @@
*
* 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)
{
@@ -188,14 +194,13 @@ int DevicesWidget::doTab(){
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;
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
@@ -20,29 +20,36 @@
*
* 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;
@@ -109,117 +116,136 @@ DialWidget::DialWidget( PPPData *pd, QWidget *parent, bool isnewaccount
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
@@ -302,22 +328,24 @@ ExecWidget::ExecWidget(PPPData *pd, QWidget *parent, bool isnewaccount, const ch
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;
}
@@ -411,38 +439,44 @@ IPWidget::IPWidget( PPPData *pd, QWidget *parent, bool isnewaccount, const char
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 "
@@ -451,32 +485,39 @@ void IPWidget::autoname_t(bool on) {
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);
}
}
@@ -594,47 +635,52 @@ DNSWidget::DNSWidget( PPPData *pd, QWidget *parent, bool isnewaccount, const cha
"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);
@@ -646,21 +692,24 @@ void DNSWidget::save() {
_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);
}
@@ -718,43 +767,51 @@ GatewayWidget::GatewayWidget( PPPData *pd, QWidget *parent, bool isnewaccount, c
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);
}
}
@@ -800,13 +857,14 @@ ScriptWidget::ScriptWidget( PPPData *pd, QWidget *parent, bool isnewaccount, con
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 ( ;
@@ -821,79 +879,92 @@ 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:
@@ -977,19 +1048,21 @@ void ScriptWidget::addButton() {
//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:
@@ -1067,14 +1140,16 @@ void ScriptWidget::insertButton() {
}
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);
@@ -1116,19 +1191,21 @@ PhoneNumberDialog::PhoneNumberDialog(QWidget *parent)
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
@@ -16,23 +16,25 @@
**
** 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 );
@@ -79,14 +81,13 @@ ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl )
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;
@@ -103,13 +104,14 @@ void ModulesInfo::updateData()
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;
@@ -180,9 +182,9 @@ void ModulesInfo::viewModules( QListViewItem *modules )
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
@@ -14,26 +14,29 @@
**
** 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 );
@@ -83,14 +86,13 @@ ProcessInfo::ProcessInfo( QWidget* parent, const char* name, WFlags fl )
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,
@@ -193,8 +195,8 @@ void ProcessInfo::viewProcess( QListViewItem *process )
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
@@ -5,65 +5,74 @@
* 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
@@ -106,13 +115,14 @@ void UserDialog::setupTab1() {
// 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);
}
@@ -133,13 +143,14 @@ void UserDialog::setupTab1() {
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);
@@ -149,13 +160,14 @@ void UserDialog::setupTab1() {
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);
@@ -163,13 +175,14 @@ 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);
// Additional groups
groupsListView=new QListView(tabpage,"groups");
@@ -192,13 +205,14 @@ void UserDialog::setupTab2() {
* @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);
@@ -206,60 +220,68 @@ bool UserDialog::addUser(int uid, int gid) {
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?
@@ -277,18 +299,23 @@ bool UserDialog::addUser(int uid, int gid) {
*
* @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;
}
@@ -298,66 +325,78 @@ bool UserDialog::delUser(const char *username) {
*
* @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.;
}
}
}
@@ -367,37 +406,42 @@ bool UserDialog::editUser(const char *username) {
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");
}
@@ -405,32 +449,39 @@ 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;
}
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();
}