summaryrefslogtreecommitdiff
path: root/noncore
Side-by-side diff
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/appearance2/appearance.cpp968
-rw-r--r--noncore/settings/appearance2/stylelistitem.h12
-rw-r--r--noncore/settings/aqpkg/categoryfilterimpl.cpp28
-rw-r--r--noncore/settings/aqpkg/instoptionsimpl.cpp44
-rw-r--r--noncore/settings/aqpkg/mainwin.cpp176
-rw-r--r--noncore/settings/aqpkg/settingsimpl.cpp243
-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.cpp1783
-rw-r--r--noncore/settings/sysinfo/modulesinfo.cpp88
-rw-r--r--noncore/settings/sysinfo/processinfo.cpp76
-rw-r--r--noncore/settings/usermanager/userdialog.cpp743
12 files changed, 2197 insertions, 2006 deletions
diff --git a/noncore/settings/appearance2/appearance.cpp b/noncore/settings/appearance2/appearance.cpp
index 9e5eede..ba12e55 100644
--- a/noncore/settings/appearance2/appearance.cpp
+++ b/noncore/settings/appearance2/appearance.cpp
@@ -27,6 +27,30 @@
*/
+#include "appearance.h"
+#include "editScheme.h"
+#include "stylelistitem.h"
+#include "decolistitem.h"
+#include "colorlistitem.h"
+#include "exceptlistitem.h"
+#include "sample.h"
+
+/* OPIE */
+#include <opie/ofontselector.h>
+#include <opie/odevice.h>
+#include <opie/ofiledialog.h>
+#include <opie/otabwidget.h>
+
+#include <qpe/config.h>
+#include <qpe/global.h>
+#include <qpe/qpeapplication.h>
+#include <qpe/qpemessagebox.h>
+#include <qpe/qcopenvelope_qws.h>
+#include <qpe/qpestyle.h>
+#include <qpe/lightstyle.h>
+#include <qpe/styleinterface.h>
+
+/* QT */
#include <qbuttongroup.h>
#include <qcheckbox.h>
#include <qcombobox.h>
@@ -49,31 +73,6 @@
#include <qvbox.h>
#include <qwhatsthis.h>
-#include <qpe/config.h>
-#include <qpe/global.h>
-#include <qpe/resource.h>
-#include <qpe/qpeapplication.h>
-#include <qpe/qpemessagebox.h>
-#include <qpe/qcopenvelope_qws.h>
-#include <qpe/qpestyle.h>
-#include <qpe/lightstyle.h>
-#include <qpe/qlibrary.h>
-#include <qpe/styleinterface.h>
-
-#include <opie/ofontselector.h>
-#include <opie/odevice.h>
-#include <opie/ofiledialog.h>
-#include <opie/otabwidget.h>
-
-#include "appearance.h"
-#include "editScheme.h"
-#include "stylelistitem.h"
-#include "decolistitem.h"
-#include "colorlistitem.h"
-#include "exceptlistitem.h"
-#include "sample.h"
-
-
using namespace Opie;
@@ -81,27 +80,30 @@ class DefaultWindowDecoration : public WindowDecorationInterface
{
public:
DefaultWindowDecoration() : ref(0) {}
- QString name() const {
- return "Default";
+ QString name() const
+ {
+ return "Default";
}
-QPixmap icon() const {
- return QPixmap();
+ QPixmap icon() const
+ {
+ return QPixmap();
}
- 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();
- return QS_OK;
+ 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();
+ return QS_OK;
}
Q_REFCOUNT
private:
- ulong ref;
+ ulong ref;
};
@@ -117,12 +119,12 @@ QWidget *Appearance::createStyleTab ( QWidget *parent, Config &cfg )
m_style_list = new QListBox( tab, "m_style_list" );
vertLayout->addWidget( m_style_list );
- QWhatsThis::add( m_style_list, tr( "Styles control the way items such as buttons and scroll bars appear in all applications.\n\nClick here to select an available style." ) );
+ QWhatsThis::add( m_style_list, tr( "Styles control the way items such as buttons and scroll bars appear in all applications.\n\nClick here to select an available style." ) );
m_style_settings = new QPushButton ( tr( "Settings..." ), tab );
connect ( m_style_settings, SIGNAL( clicked ( )), this, SLOT( styleSettingsClicked ( )));
vertLayout-> addWidget ( m_style_settings );
- QWhatsThis::add( m_style_settings, tr( "Click here to configure the currently selected style.\n\nNote: This option is not available for all styles." ) );
+ QWhatsThis::add( m_style_settings, tr( "Click here to configure the currently selected style.\n\nNote: This option is not available for all styles." ) );
QString s = cfg. readEntry ( "Style", "Light" );
@@ -134,36 +136,39 @@ QWidget *Appearance::createStyleTab ( QWidget *parent, Config &cfg )
m_style_list-> insertItem ( new StyleListItem ( "Light", new LightStyle ( )));
m_style_list-> insertItem ( new StyleListItem ( "QPE", new QPEStyle ( )));
#endif
- {
- QString path = QPEApplication::qpeDir ( );
- path.append( "/plugins/styles/" );
- QStringList sl = QDir ( path, "lib*.so" ). entryList ( );
-
- for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) {
- 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 ) {
- StyleListItem *slit = new StyleListItem ( lib, iface );
- m_style_list-> insertItem ( slit );
-
- if ( slit-> key ( ) == s )
- m_style_list-> setCurrentItem ( slit );
- }
- else
- delete lib;
- }
- }
+
+ {
+ 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 )
+ {
+ 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 )
+ {
+ StyleListItem *slit = new StyleListItem ( lib, iface );
+ m_style_list-> insertItem ( slit );
+
+ if ( slit-> key ( ) == s )
+ m_style_list-> setCurrentItem ( slit );
+ }
+ else
+ delete lib;
+ }
+ }
m_original_style = m_style_list-> currentItem ( );
styleClicked ( m_original_style );
connect( m_style_list, SIGNAL( highlighted( int ) ), this, SLOT( styleClicked( int ) ) );
- return tab;
+ return tab;
}
QWidget *Appearance::createDecoTab ( QWidget *parent, Config &cfg )
@@ -173,44 +178,46 @@ QWidget *Appearance::createDecoTab ( QWidget *parent, Config &cfg )
m_deco_list = new QListBox( tab, "m_deco_list" );
vertLayout->addWidget( m_deco_list );
- QWhatsThis::add( m_deco_list, tr( "Window decorations control the way the application title bar and its buttons appear.\n\nClick here to select an available decoration." ) );
+ QWhatsThis::add( m_deco_list, tr( "Window decorations control the way the application title bar and its buttons appear.\n\nClick here to select an available decoration." ) );
QString s = cfg. readEntry ( "Decoration", "libflat.so" );
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 ) {
- QString libstr = path;
- libstr.append( "/" );
- libstr.append( *it );
- QLibrary *lib = new QLibrary ( libstr );
- WindowDecorationInterface *iface;
-
- 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;
- }
- }
+ {
+ 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 )
+ {
+ QString libstr = path;
+ libstr.append( "/" );
+ libstr.append( *it );
+ QLibrary *lib = new QLibrary ( libstr );
+ WindowDecorationInterface *iface;
+
+ 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;
+ }
+ }
m_original_deco = m_deco_list-> currentItem ( );
if ( m_deco_list-> currentItem ( ) < 0 )
- m_deco_list-> setCurrentItem ( 0 );
+ m_deco_list-> setCurrentItem ( 0 );
decoClicked ( m_original_deco );
connect( m_deco_list, SIGNAL( highlighted( int ) ), this, SLOT( decoClicked( int ) ) );
- return tab;
+ return tab;
}
QWidget *Appearance::createFontTab ( QWidget *parent, Config &cfg )
@@ -221,7 +228,7 @@ QWidget *Appearance::createFontTab ( QWidget *parent, Config &cfg )
m_fontselect = new OFontSelector ( false, parent, "FontTab" );
m_fontselect-> setSelectedFont ( familyStr, styleStr, size );
- QWhatsThis::add( m_fontselect, tr( "Select the desired name, style and size of the default font applications will use." ) );
+ QWhatsThis::add( m_fontselect, tr( "Select the desired name, style and size of the default font applications will use." ) );
connect( m_fontselect, SIGNAL( fontSelected ( const QFont & )),
this, SLOT( fontClicked ( const QFont & )));
@@ -238,23 +245,24 @@ QWidget *Appearance::createColorTab ( QWidget *parent, Config &cfg )
m_color_list = new QListBox ( tab );
gridLayout->addMultiCellWidget ( m_color_list, 0, 3, 0, 0 );
connect( m_color_list, SIGNAL( highlighted( int ) ), this, SLOT( colorClicked( int ) ) );
- 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." ) );
+ 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 ));
+ m_color_list-> insertItem ( new ColorListItem ( tr( "Current scheme" ), cfg ));
- QString path = QPEApplication::qpeDir ( );
- path.append( "/etc/colors/" );
+ QString path = QPEApplication::qpeDir ( );
+ path.append( "/etc/colors/" );
QStringList sl = QDir ( path ). entryList ( "*.scheme" );
- 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" );
+ 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 ));
- }
+ m_color_list-> insertItem ( new ColorListItem ( name, config ));
+ }
m_color_list-> setCurrentItem ( 0 );
@@ -262,19 +270,19 @@ QWidget *Appearance::createColorTab ( QWidget *parent, Config &cfg )
tempButton->setText( tr( "Edit..." ) );
connect( tempButton, SIGNAL( clicked() ), this, SLOT( editSchemeClicked() ) );
gridLayout->addWidget( tempButton, 0, 1 );
- QWhatsThis::add( tempButton, tr( "Click here to change the colors in the current color scheme." ) );
+ QWhatsThis::add( tempButton, tr( "Click here to change the colors in the current color scheme." ) );
tempButton = new QPushButton( tab, "deleteSchemeButton" );
tempButton->setText( tr( "Delete" ) );
connect( tempButton, SIGNAL( clicked() ), this, SLOT( deleteSchemeClicked() ) );
gridLayout->addWidget( tempButton, 1, 1 );
- QWhatsThis::add( tempButton, tr( "Click here to delete the color scheme selected in the list to the left." ) );
+ QWhatsThis::add( tempButton, tr( "Click here to delete the color scheme selected in the list to the left." ) );
tempButton = new QPushButton( tab, "saveSchemeButton" );
tempButton->setText( tr( "Save" ) );
connect( tempButton, SIGNAL( clicked() ), this, SLOT( saveSchemeClicked() ) );
gridLayout->addWidget( tempButton, 2, 1 );
- QWhatsThis::add( tempButton, tr( "Click here to name and save the current color scheme." ) );
+ QWhatsThis::add( tempButton, tr( "Click here to name and save the current color scheme." ) );
return tab;
}
@@ -284,92 +292,93 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg )
QWidget *tab = new QWidget ( parent );
QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 );
- QGridLayout *lay = new QGridLayout ( vertLayout, 0, 0, 3, 0 );
-
- m_force = new QCheckBox ( tr( "Force styling for all applications." ), tab );
- m_force-> setChecked ( cfg. readBoolEntry ( "ForceStyle" ));
- lay-> addMultiCellWidget ( m_force, 0, 0, 0, 1 );
- QWhatsThis::add( m_force, tr( "Click here to allow all applications to use global appearance settings." ) );
-
- QLabel *l = new QLabel ( tab );
- l-> setText ( QString ( "<p>%1</p>" ). arg ( tr( "Disable styling for these applications ( <b>*</b> can be used as a wildcard):" )));
- lay-> addMultiCellWidget ( l, 1, 1, 0, 1 );
- QWhatsThis::add( l, tr( "If some applications do not display correctly with the global appearance settings, certain features can be turned off for that application.\n\nThis area allows you to select an application and which settings you wish to disable." ) );
-
- m_except = new QListView ( tab );
- m_except-> addColumn ( Resource::loadIconSet ( "appearance" ), "", 24 );
- m_except-> addColumn ( Resource::loadIconSet ( "font" ), "", 24 );
- m_except-> addColumn ( Resource::loadIconSet ( "appearance/deco" ), "", 24 );
- m_except-> addColumn ( tr( "Binary file(s)" ));
- m_except-> setColumnAlignment ( 0, AlignCenter );
- m_except-> setColumnAlignment ( 1, AlignCenter );
- m_except-> setColumnAlignment ( 2, AlignCenter );
- m_except-> setAllColumnsShowFocus ( true );
- m_except-> setMinimumHeight ( 30 );
- m_except-> header ( )-> setClickEnabled ( false );
- m_except-> header ( )-> setResizeEnabled ( false );
- m_except-> header ( )-> setMovingEnabled ( false );
- m_except-> setSorting ( -1 );
- lay-> addMultiCellWidget ( m_except, 2, 6, 0, 0 );
- QWhatsThis::add( m_except, tr( "If some applications do not display correctly with the global appearance settings, certain features can be turned off for that application.\n\nThis area allows you to select an application and which settings you wish to disable." ) );
-
- connect ( m_except, SIGNAL( clicked ( QListViewItem *, const QPoint &, int )), this, SLOT( clickedExcept ( QListViewItem *, const QPoint &, int )));
-
- QToolButton *tb = new QToolButton ( tab );
- tb-> setIconSet ( Resource::loadIconSet ( "appearance/add" ));
- tb-> setFocusPolicy ( QWidget::StrongFocus );
- lay-> addWidget ( tb, 2, 1 );
- connect ( tb, SIGNAL( clicked ( )), this, SLOT( addExcept ( )));
- QWhatsThis::add( tb, tr( "Click here to add an application to the list above." ) );
-
- tb = new QToolButton ( tab );
- tb-> setIconSet ( Resource::loadIconSet ( "editdelete" ));
- tb-> setFocusPolicy ( QWidget::StrongFocus );
- lay-> addWidget ( tb, 3, 1 );
- connect ( tb, SIGNAL( clicked ( )), this, SLOT( delExcept ( )));
- QWhatsThis::add( tb, tr( "Click here to delete the currently selected application." ) );
-
- tb = new QToolButton ( tab );
- tb-> setIconSet ( Resource::loadIconSet ( "up" ));
- tb-> setFocusPolicy ( QWidget::StrongFocus );
- lay-> addWidget ( tb, 4, 1 );
- connect ( tb, SIGNAL( clicked ( )), this, SLOT( upExcept ( )));
- QWhatsThis::add( tb, tr( "Click here to move the currently selected application up in the list." ) );
-
- tb = new QToolButton ( tab );
- tb-> setIconSet ( Resource::loadIconSet ( "down" ));
- tb-> setFocusPolicy ( QWidget::StrongFocus );
- lay-> addWidget ( tb, 5, 1 );
- 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 ) {
- 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 );
- f-> setFrameStyle ( QFrame::HLine | QFrame::Sunken );
- vertLayout-> addWidget ( f );
- vertLayout-> addSpacing ( 3 );
+ QGridLayout *lay = new QGridLayout ( vertLayout, 0, 0, 3, 0 );
+
+ m_force = new QCheckBox ( tr( "Force styling for all applications." ), tab );
+ m_force-> setChecked ( cfg. readBoolEntry ( "ForceStyle" ));
+ lay-> addMultiCellWidget ( m_force, 0, 0, 0, 1 );
+ QWhatsThis::add( m_force, tr( "Click here to allow all applications to use global appearance settings." ) );
+
+ QLabel *l = new QLabel ( tab );
+ l-> setText ( QString ( "<p>%1</p>" ). arg ( tr( "Disable styling for these applications ( <b>*</b> can be used as a wildcard):" )));
+ lay-> addMultiCellWidget ( l, 1, 1, 0, 1 );
+ QWhatsThis::add( l, tr( "If some applications do not display correctly with the global appearance settings, certain features can be turned off for that application.\n\nThis area allows you to select an application and which settings you wish to disable." ) );
+
+ m_except = new QListView ( tab );
+ m_except-> addColumn ( Resource::loadIconSet ( "appearance" ), "", 24 );
+ m_except-> addColumn ( Resource::loadIconSet ( "font" ), "", 24 );
+ m_except-> addColumn ( Resource::loadIconSet ( "appearance/deco" ), "", 24 );
+ m_except-> addColumn ( tr( "Binary file(s)" ));
+ m_except-> setColumnAlignment ( 0, AlignCenter );
+ m_except-> setColumnAlignment ( 1, AlignCenter );
+ m_except-> setColumnAlignment ( 2, AlignCenter );
+ m_except-> setAllColumnsShowFocus ( true );
+ m_except-> setMinimumHeight ( 30 );
+ m_except-> header ( )-> setClickEnabled ( false );
+ m_except-> header ( )-> setResizeEnabled ( false );
+ m_except-> header ( )-> setMovingEnabled ( false );
+ m_except-> setSorting ( -1 );
+ lay-> addMultiCellWidget ( m_except, 2, 6, 0, 0 );
+ QWhatsThis::add( m_except, tr( "If some applications do not display correctly with the global appearance settings, certain features can be turned off for that application.\n\nThis area allows you to select an application and which settings you wish to disable." ) );
+
+ connect ( m_except, SIGNAL( clicked ( QListViewItem *, const QPoint &, int )), this, SLOT( clickedExcept ( QListViewItem *, const QPoint &, int )));
+
+ QToolButton *tb = new QToolButton ( tab );
+ tb-> setIconSet ( Resource::loadIconSet ( "appearance/add" ));
+ tb-> setFocusPolicy ( QWidget::StrongFocus );
+ lay-> addWidget ( tb, 2, 1 );
+ connect ( tb, SIGNAL( clicked ( )), this, SLOT( addExcept ( )));
+ QWhatsThis::add( tb, tr( "Click here to add an application to the list above." ) );
+
+ tb = new QToolButton ( tab );
+ tb-> setIconSet ( Resource::loadIconSet ( "editdelete" ));
+ tb-> setFocusPolicy ( QWidget::StrongFocus );
+ lay-> addWidget ( tb, 3, 1 );
+ connect ( tb, SIGNAL( clicked ( )), this, SLOT( delExcept ( )));
+ QWhatsThis::add( tb, tr( "Click here to delete the currently selected application." ) );
+
+ tb = new QToolButton ( tab );
+ tb-> setIconSet ( Resource::loadIconSet ( "up" ));
+ tb-> setFocusPolicy ( QWidget::StrongFocus );
+ lay-> addWidget ( tb, 4, 1 );
+ connect ( tb, SIGNAL( clicked ( )), this, SLOT( upExcept ( )));
+ QWhatsThis::add( tb, tr( "Click here to move the currently selected application up in the list." ) );
+
+ tb = new QToolButton ( tab );
+ tb-> setIconSet ( Resource::loadIconSet ( "down" ));
+ tb-> setFocusPolicy ( QWidget::StrongFocus );
+ lay-> addWidget ( tb, 5, 1 );
+ 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 )
+ {
+ 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 );
+ f-> setFrameStyle ( QFrame::HLine | QFrame::Sunken );
+ vertLayout-> addWidget ( f );
+ vertLayout-> addSpacing ( 3 );
QGridLayout* gridLayout = new QGridLayout ( vertLayout, 0, 0, 3, 0 );
- int style = cfg. readNumEntry ( "TabStyle", 2 ) - 1;
- bool tabtop = ( cfg. readEntry ( "TabPosition", "Top" ) == "Top" );
+ int style = cfg. readNumEntry ( "TabStyle", 2 ) - 1;
+ bool tabtop = ( cfg. readEntry ( "TabPosition", "Top" ) == "Top" );
QLabel* label = new QLabel( tr( "Tab style:" ), tab );
gridLayout-> addWidget ( label, 0, 0 );
- QWhatsThis::add( label, tr( "Click here to select a desired style for tabbed dialogs (such as this application). The styles available are:\n\n1. Tabs - normal tabs with text labels only\n2. Tabs w/icons - tabs with icons for each tab, text label only appears on current tab\n3. Drop down list - a vertical listing of tabs\n4. Drop down list w/icons - a vertical listing of tabs with icons" ) );
+ QWhatsThis::add( label, tr( "Click here to select a desired style for tabbed dialogs (such as this application). The styles available are:\n\n1. Tabs - normal tabs with text labels only\n2. Tabs w/icons - tabs with icons for each tab, text label only appears on current tab\n3. Drop down list - a vertical listing of tabs\n4. Drop down list w/icons - a vertical listing of tabs with icons" ) );
QButtonGroup* btngrp = new QButtonGroup( tab, "buttongroup" );
btngrp-> hide ( );
@@ -382,72 +391,75 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg )
m_tabstyle_list-> insertItem ( tr( "Drop down list w/icons" ));
m_tabstyle_list-> setCurrentItem ( style );
gridLayout-> addMultiCellWidget ( m_tabstyle_list, 0, 0, 1, 2 );
- QWhatsThis::add( m_tabstyle_list, tr( "Click here to select a desired style for tabbed dialogs (such as this application). The styles available are:\n\n1. Tabs - normal tabs with text labels only\n2. Tabs w/icons - tabs with icons for each tab, text label only appears on current tab\n3. Drop down list - a vertical listing of tabs\n4. Drop down list w/icons - a vertical listing of tabs with icons" ) );
+ QWhatsThis::add( m_tabstyle_list, tr( "Click here to select a desired style for tabbed dialogs (such as this application). The styles available are:\n\n1. Tabs - normal tabs with text labels only\n2. Tabs w/icons - tabs with icons for each tab, text label only appears on current tab\n3. Drop down list - a vertical listing of tabs\n4. Drop down list w/icons - a vertical listing of tabs with icons" ) );
m_tabstyle_top = new QRadioButton( tr( "Top" ), tab, "tabpostop" );
btngrp-> insert ( m_tabstyle_top );
gridLayout-> addWidget( m_tabstyle_top, 1, 1 );
- QWhatsThis::add( m_tabstyle_top, tr( "Click here so that tabs appear at the top of the window." ) );
+ QWhatsThis::add( m_tabstyle_top, tr( "Click here so that tabs appear at the top of the window." ) );
m_tabstyle_bottom = new QRadioButton( tr( "Bottom" ), tab, "tabposbottom" );
btngrp-> insert ( m_tabstyle_bottom );
gridLayout-> addWidget( m_tabstyle_bottom, 1, 2 );
- QWhatsThis::add( m_tabstyle_bottom, tr( "Click here so that tabs appear at the bottom of the window." ) );
+ QWhatsThis::add( m_tabstyle_bottom, tr( "Click here so that tabs appear at the bottom of the window." ) );
m_tabstyle_top-> setChecked ( tabtop );
m_tabstyle_bottom-> setChecked ( !tabtop );
- m_original_tabstyle = style;
- m_original_tabpos = tabtop;
-
- vertLayout-> addSpacing ( 3 );
- QHBoxLayout *rotLay = new QHBoxLayout ( vertLayout, 3 );
-
- QLabel* rotlabel = new QLabel( tr( "Rotation direction:" ), tab );
- m_rotdir_cw = new QRadioButton( tab, "rotdir_cw" );
- QPixmap cw1 = Resource::loadIconSet("redo"). pixmap( );
- m_rotdir_ccw = new QRadioButton( tab, "rotdir_ccw" );
- QImage ccwImage = cw1. convertToImage( ). mirror( 1, 0 );
- QPixmap ccw1;
- m_rotdir_flip = new QRadioButton( tab, "rotdir_flip" );
- QPixmap flip1 = Resource::loadIconSet("pass"). pixmap( );
- QButtonGroup* rotbtngrp = new QButtonGroup( tab, "rotbuttongroup" );
-
- rotbtngrp-> hide ( );
- rotbtngrp-> setExclusive ( true );
- rotbtngrp-> insert ( m_rotdir_cw );
- rotbtngrp-> insert ( m_rotdir_ccw );
- rotbtngrp-> insert ( m_rotdir_flip );
-
- ccw1. convertFromImage( ccwImage );
- m_rotdir_cw-> setPixmap( cw1 );
- m_rotdir_ccw-> setPixmap( ccw1 );
- m_rotdir_flip-> setPixmap( flip1 );
-
- 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) {
- rot = ODevice::inst ( )-> direction ( );
- } else {
- rot = (ODirection)rotDirection;
- }
-
- m_rotdir_cw-> setChecked ( rot == CW );
- m_rotdir_ccw-> setChecked ( rot == CCW );
- m_rotdir_flip-> setChecked ( rot == Flip );
-
- return tab;
+ m_original_tabstyle = style;
+ m_original_tabpos = tabtop;
+
+ vertLayout-> addSpacing ( 3 );
+ QHBoxLayout *rotLay = new QHBoxLayout ( vertLayout, 3 );
+
+ QLabel* rotlabel = new QLabel( tr( "Rotation direction:" ), tab );
+ m_rotdir_cw = new QRadioButton( tab, "rotdir_cw" );
+ QPixmap cw1 = Resource::loadIconSet("redo"). pixmap( );
+ m_rotdir_ccw = new QRadioButton( tab, "rotdir_ccw" );
+ QImage ccwImage = cw1. convertToImage( ). mirror( 1, 0 );
+ QPixmap ccw1;
+ m_rotdir_flip = new QRadioButton( tab, "rotdir_flip" );
+ QPixmap flip1 = Resource::loadIconSet("pass"). pixmap( );
+ QButtonGroup* rotbtngrp = new QButtonGroup( tab, "rotbuttongroup" );
+
+ rotbtngrp-> hide ( );
+ rotbtngrp-> setExclusive ( true );
+ rotbtngrp-> insert ( m_rotdir_cw );
+ rotbtngrp-> insert ( m_rotdir_ccw );
+ rotbtngrp-> insert ( m_rotdir_flip );
+
+ ccw1. convertFromImage( ccwImage );
+ m_rotdir_cw-> setPixmap( cw1 );
+ m_rotdir_ccw-> setPixmap( ccw1 );
+ m_rotdir_flip-> setPixmap( flip1 );
+
+ 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)
+ {
+ rot = ODevice::inst ( )-> direction ( );
+ }
+ else
+ {
+ rot = (ODirection)rotDirection;
+ }
+
+ m_rotdir_cw-> setChecked ( rot == CW );
+ m_rotdir_ccw-> setChecked ( rot == CCW );
+ m_rotdir_flip-> setChecked ( rot == Flip );
+
+ return tab;
}
Appearance::Appearance( QWidget* parent, const char* name, WFlags )
- : QDialog ( parent, name, true, WStyle_ContextHelp )
+ : QDialog ( parent, name, true, WStyle_ContextHelp )
{
setCaption( tr( "Appearance Settings" ) );
@@ -456,71 +468,75 @@ Appearance::Appearance( QWidget* parent, const char* name, WFlags )
QVBoxLayout *top = new QVBoxLayout ( this, 3, 3 );
- m_sample = new SampleWindow ( this );
+ m_sample = new SampleWindow ( this );
- m_sample-> setDecoration ( new DefaultWindowDecoration ( ) );
- QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) );
+ m_sample-> setDecoration ( new DefaultWindowDecoration ( ) );
+ QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) );
OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom );
- QWidget *styletab;
+ QWidget *styletab;
- m_color_list = 0;
+ m_color_list = 0;
- tw-> addTab ( styletab = createStyleTab ( tw, config ), "appearance", tr( "Style" ));
+ tw-> addTab ( styletab = createStyleTab ( tw, config ), "appearance", tr( "Style" ));
tw-> addTab ( createFontTab ( tw, config ), "font", tr( "Font" ));
tw-> addTab ( createColorTab ( tw, config ), "appearance/color", tr( "Colors" ) );
tw-> addTab ( createDecoTab ( tw, config ), "appearance/deco", tr( "Windows" ) );
- tw-> addTab ( m_advtab = createAdvancedTab ( tw, config ), "SettingsIcon", tr( "Advanced" ) );
+ tw-> addTab ( m_advtab = createAdvancedTab ( tw, config ), "SettingsIcon", tr( "Advanced" ) );
- top-> addWidget ( tw, 10 );
- top-> addWidget ( m_sample, 1 );
+ top-> addWidget ( tw, 10 );
+ top-> addWidget ( m_sample, 1 );
tw-> setCurrentTab ( styletab );
- connect ( tw, SIGNAL( currentChanged ( QWidget * )), this, SLOT( tabChanged ( QWidget * )));
+ 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 ) {
- m_sample-> hide ( );
- updateGeometry ( ); // shouldn't be necessary ...
- }
- else
- m_sample-> show ( );
+ 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 ( );
+ bool newtabpos = m_tabstyle_top-> isChecked ( );
+ int newtabstyle = m_tabstyle_list-> currentItem ( );
Config config ( "qpe" );
config. setGroup ( "Appearance" );
- if ( m_style_changed ) {
- StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( ));
- if ( item )
+ 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 ) {
- DecoListItem *item = (DecoListItem *) m_deco_list-> item ( m_deco_list-> currentItem ( ));
- if ( item )
+ 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 )) {
- config. writeEntry ( "TabStyle", newtabstyle + 1 );
- config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" );
- }
+ 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 ( ));
@@ -529,151 +545,164 @@ void Appearance::accept ( )
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 ( )) {
- rot = CCW;
- } else if (m_rotdir_cw-> isChecked ( )) {
- rot = CW;
- } 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 ( )) {
- 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;
- }
- config. writeEntry ( "NoStyle", sl, ';' );
- config. writeEntry ( "ForceStyle", m_force-> isChecked ( ));
-
- config. write ( ); // need to flush the config info first
- Global::applyStyle ( );
-
- QDialog::accept ( );
+ ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
+
+ if ( item )
+ item-> save ( config );
+ }
+
+ ODirection rot;
+ if (m_rotdir_ccw-> isChecked ( ))
+ {
+ rot = CCW;
+ }
+ else if (m_rotdir_cw-> isChecked ( ))
+ {
+ rot = CW;
+ }
+ 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 ( ))
+ {
+ 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;
+ }
+ config. writeEntry ( "NoStyle", sl, ';' );
+ config. writeEntry ( "ForceStyle", m_force-> isChecked ( ));
+
+ config. write ( ); // need to flush the config info first
+ Global::applyStyle ( );
+
+ QDialog::accept ( );
}
void Appearance::done ( int r )
{
- QDialog::done ( r );
- close ( );
+ QDialog::done ( r );
+ close ( );
}
void Appearance::styleClicked ( int index )
{
StyleListItem *sli = (StyleListItem *) m_style_list-> item ( index );
- m_style_settings-> setEnabled ( sli ? sli-> hasSettings ( ) : false );
+ m_style_settings-> setEnabled ( sli ? sli-> hasSettings ( ) : false );
- if ( m_sample && sli && sli-> style ( )) {
- int ci = m_color_list ? m_color_list-> currentItem ( ) : -1;
+ 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_sample-> setStyle2 ( sli-> style ( ), ci < 0 ? palette ( ) : ((ColorListItem *) m_color_list-> item ( ci ))-> palette ( ));
+ }
- m_style_changed |= ( index != m_original_style );
+ m_style_changed |= ( index != m_original_style );
}
void Appearance::styleSettingsClicked ( )
{
- StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( ));
+ StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( ));
- if ( item && item-> hasSettings ( )) {
- QDialog *d = new QDialog ( this, "SETTINGS-DLG", true );
- QVBoxLayout *vbox = new QVBoxLayout ( d, 3, 0 );
+ if ( item && item-> hasSettings ( ))
+ {
+ QDialog *d = new QDialog ( this, "SETTINGS-DLG", true );
+ QVBoxLayout *vbox = new QVBoxLayout ( d, 3, 0 );
- QWidget *w = item-> settings ( d );
+ QWidget *w = item-> settings ( d );
- if ( w ) {
- vbox-> addWidget ( w );
+ if ( w )
+ {
+ vbox-> addWidget ( w );
- d-> setCaption ( w-> caption ( ));
+ 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;
- }
+ 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 ( dli && dli-> interface ( ))
- m_sample-> setDecoration ( dli-> interface ( ));
- else
- m_sample-> setDecoration ( new DefaultWindowDecoration ( ));
- m_sample-> repaint ( );
- }
- m_deco_changed |= ( index != m_original_deco );
+ 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 );
}
void Appearance::fontClicked ( const QFont &f )
{
- m_font_changed |= ( f != m_sample-> font ( ));
- m_sample-> setFont ( f );
+ m_font_changed |= ( f != m_sample-> font ( ));
+ m_sample-> setFont ( f );
}
void Appearance::colorClicked ( int index )
{
- ColorListItem *item = (ColorListItem *) m_color_list-> item ( index );
+ ColorListItem *item = (ColorListItem *) m_color_list-> item ( index );
- if ( item )
- m_sample-> setPalette ( item-> palette ( ));
+ if ( item )
+ m_sample-> setPalette ( item-> palette ( ));
- m_color_changed |= ( item-> palette ( ) != qApp-> palette ( ));
+ m_color_changed |= ( item-> palette ( ) != qApp-> palette ( ));
}
void Appearance::editSchemeClicked ( )
{
- ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
+ ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
- int cnt = 0;
- QString labels [QColorGroup::NColorRoles];
- QColor colors [QColorGroup::NColorRoles];
+ int cnt = 0;
+ QString labels [QColorGroup::NColorRoles];
+ QColor colors [QColorGroup::NColorRoles];
- for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) {
- QColor col = item-> color ( role );
+ for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ )
+ {
+ QColor col = item-> color ( role );
- if ( col. isValid ( )) {
- labels [cnt] = item-> label ( role );
- colors [cnt] = col;
+ if ( col. isValid ( ))
+ {
+ labels [cnt] = item-> label ( role );
+ colors [cnt] = col;
- cnt++;
- }
- }
+ cnt++;
+ }
+ }
EditScheme* editdlg = new EditScheme( cnt, labels, colors, this, "editScheme", true );
- editdlg-> showMaximized ( );
- if ( editdlg-> exec ( ) == 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 ( )) {
- citem-> setColor ( role, colors [cnt] );
- cnt++;
- }
+ 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 ( ))
+ {
+ citem-> setColor ( role, colors [cnt] );
+ cnt++;
+ }
}
m_color_list-> setCurrentItem ( 0 );
@@ -687,32 +716,33 @@ void Appearance::editSchemeClicked ( )
void Appearance::saveSchemeClicked()
{
- ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
+ ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
- if ( !item )
- return;
+ if ( !item )
+ 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 ( );
+ 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" );
+ QString filestr = QPEApplication::qpeDir();
+ filestr.append( "/etc/colors/" );
+ filestr.append( schemename );
+ filestr.append( ".scheme" );
QFile file ( filestr );
if ( !file. exists ( ))
{
- QPalette p = item-> palette ( );
+ QPalette p = item-> palette ( );
Config config ( file.name(), Config::File );
config. setGroup( "Colors" );
- item-> save ( config );
+ item-> save ( config );
config. write ( ); // need to flush the config info first
@@ -720,7 +750,7 @@ void Appearance::saveSchemeClicked()
}
else
{
- QMessageBox::information ( this, tr( "Save scheme" ), tr( "Scheme does already exist." ));
+ QMessageBox::information ( this, tr( "Save scheme" ), tr( "Scheme does already exist." ));
}
}
delete d;
@@ -728,21 +758,21 @@ void Appearance::saveSchemeClicked()
void Appearance::deleteSchemeClicked()
{
- ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
+ ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
- if ( !item )
- return;
+ if ( !item )
+ return;
if ( m_color_list-> currentItem ( ) > 0 )
{
- if ( QPEMessageBox::confirmDelete ( this, tr( "Delete scheme" ), item-> text ( ) ) )
- {
- QString filestr = QPEApplication::qpeDir ( );
- filestr.append( "/etc/colors/" );
- filestr.append( item-> text ( ) );
- filestr.append( ".scheme" );
- QFile::remove ( filestr );
- delete item;
+ if ( QPEMessageBox::confirmDelete ( this, tr( "Delete scheme" ), item-> text ( ) ) )
+ {
+ QString filestr = QPEApplication::qpeDir ( );
+ filestr.append( "/etc/colors/" );
+ filestr.append( item-> text ( ) );
+ filestr.append( ".scheme" );
+ QFile::remove ( filestr );
+ delete item;
}
}
else
@@ -754,103 +784,107 @@ void Appearance::deleteSchemeClicked()
void Appearance::addExcept ( )
{
- ExceptListItem *it = new ExceptListItem ( m_except, 0, tr( "<new>" ), true, true, true );
- m_except-> ensureItemVisible ( it );
- m_except-> setSelected ( it, true );
+ 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 ( )) {
- m_except-> setFocus ( );
- delete m_except-> selectedItem ( );
- }
+ if ( m_except-> selectedItem ( ))
+ {
+ m_except-> setFocus ( );
+ delete m_except-> selectedItem ( );
+ }
}
void Appearance::upExcept ( )
{
- ExceptListItem *it = (ExceptListItem *) m_except-> selectedItem ( );
+ ExceptListItem *it = (ExceptListItem *) m_except-> selectedItem ( );
- if ( it && it-> itemAbove ( ))
- it-> itemAbove ( )-> moveItem ( it );
+ if ( it && it-> itemAbove ( ))
+ it-> itemAbove ( )-> moveItem ( it );
}
void Appearance::downExcept ( )
{
- ExceptListItem *it = (ExceptListItem *) m_except-> selectedItem ( );
+ ExceptListItem *it = (ExceptListItem *) m_except-> selectedItem ( );
- if ( it && it-> itemBelow ( ))
- it-> moveItem ( it-> itemBelow ( ));
+ 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 );
-
- int x = it-> listView ( )-> header ( )-> cellPos ( 3 ) - 1;
- int y = r. y ( );
- int w = it-> listView ( )-> viewport ( )-> width ( ) - x;
- int h = r. height ( ); // + 2;
-
- setText ( it-> pattern ( ));
- setGeometry ( x, y, w, h );
-
- qDebug ( "ExEdit: [%s] at %d,%d %d,%d", it->text(2).latin1(),x,y,w,h);
-
- m_out = true;
-
- show ( );
- setFocus ( );
- selectAll ( );
- end ( true );
- }
-
- virtual void focusOutEvent ( QFocusEvent * )
- {
- hide ( );
- if ( m_out )
- it-> setPattern ( text ( ));
- delete this;
- }
-
- virtual void keyPressEvent ( QKeyEvent *e )
- {
- if ( e-> key ( ) == Key_Return )
- it-> listView ( )-> setFocus ( );
- else if ( e-> key ( ) == Key_Escape ) {
- m_out = false;
- it-> listView ( )-> setFocus ( );
- }
- else
- QLineEdit::keyPressEvent ( e );
- }
+ ExEdit ( ExceptListItem *item )
+ : QLineEdit ( item-> listView ( )-> viewport ( ), "exedit" ), it ( item )
+ {
+ setFrame ( false );
+
+ QRect r = it-> listView ( )-> itemRect ( it );
+
+ int x = it-> listView ( )-> header ( )-> cellPos ( 3 ) - 1;
+ int y = r. y ( );
+ int w = it-> listView ( )-> viewport ( )-> width ( ) - x;
+ int h = r. height ( ); // + 2;
+
+ setText ( it-> pattern ( ));
+ setGeometry ( x, y, w, h );
+
+ qDebug ( "ExEdit: [%s] at %d,%d %d,%d", it->text(2).latin1(),x,y,w,h);
+
+ m_out = true;
+
+ show ( );
+ setFocus ( );
+ selectAll ( );
+ end ( true );
+ }
+
+ virtual void focusOutEvent ( QFocusEvent * )
+ {
+ hide ( );
+ if ( m_out )
+ it-> setPattern ( text ( ));
+ delete this;
+ }
+
+ virtual void keyPressEvent ( QKeyEvent *e )
+ {
+ if ( e-> key ( ) == Key_Return )
+ it-> listView ( )-> setFocus ( );
+ else if ( e-> key ( ) == Key_Escape )
+ {
+ m_out = false;
+ it-> listView ( )-> setFocus ( );
+ }
+ else
+ QLineEdit::keyPressEvent ( e );
+ }
private:
- ExceptListItem *it;
- bool m_out;
+ ExceptListItem *it;
+ bool m_out;
};
void Appearance::clickedExcept ( QListViewItem *item, const QPoint &, int c )
{
- if ( !item || c < 0 || c > 3 )
- return;
-
- 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 ) {
- m_except-> ensureItemVisible ( it );
- new ExEdit ( it );
- }
+ if ( !item || c < 0 || c > 3 )
+ return;
+
+ 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 )
+ {
+ m_except-> ensureItemVisible ( it );
+ new ExEdit ( it );
+ }
}
diff --git a/noncore/settings/appearance2/stylelistitem.h b/noncore/settings/appearance2/stylelistitem.h
index caefad8..b6c72c3 100644
--- a/noncore/settings/appearance2/stylelistitem.h
+++ b/noncore/settings/appearance2/stylelistitem.h
@@ -28,15 +28,21 @@
#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 )
- {
+ StyleListItem ( const QString &t, QStyle *sty ) : QListBoxText ( t )
+ {
m_lib = 0;
m_style_if = 0;
m_settings_if = 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
@@ -27,18 +27,24 @@
*/
-#include <iostream>
-using namespace std;
+#include "categoryfilterimpl.h"
+
+/* OPIE */
+#include <qpe/qpeapplication.h>
+/* QT */
#include <qgroupbox.h>
-#include <qlayout.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 )
+ : QDialog( parent, name, true )
{
setCaption( tr( "Category Filter" ) );
@@ -52,11 +58,11 @@ CategoryFilterImpl :: CategoryFilterImpl(const QString &categories, const QStrin
layout->addWidget( grpbox );
QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() );
-
+
lstCategories = new QListBox( grpbox );
lstCategories->setSelectionMode( QListBox::Multi );
grplayout->addWidget( lstCategories );
-
+
// Split up categories and add them to the listbox
int start = 1;
@@ -76,16 +82,16 @@ CategoryFilterImpl :: CategoryFilterImpl(const QString &categories, const QStrin
}
start = end + 1;
- } while ( start < (int)categories.length() );
+ }
+ while ( start < (int)categories.length() );
lstCategories->sort( true );
- showMaximized();
+ QPEApplication::showDialog( this );
}
CategoryFilterImpl :: ~CategoryFilterImpl()
-{
-}
+{}
QString CategoryFilterImpl :: getSelectedFilter()
{
diff --git a/noncore/settings/aqpkg/instoptionsimpl.cpp b/noncore/settings/aqpkg/instoptionsimpl.cpp
index 9d52013..126e3b9 100644
--- a/noncore/settings/aqpkg/instoptionsimpl.cpp
+++ b/noncore/settings/aqpkg/instoptionsimpl.cpp
@@ -27,25 +27,28 @@
*/
+#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 )
+ : QDialog( parent, name, modal, fl )
{
setCaption( tr( "Options" ) );
-
+
QVBoxLayout *layout = new QVBoxLayout( this );
layout->setMargin( 2 );
layout->setSpacing( 4 );
@@ -56,7 +59,7 @@ InstallOptionsDlgImpl::InstallOptionsDlgImpl( int flags, int verb, QWidget * par
layout->addWidget( grpbox );
QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() );
-
+
forceDepends = new QCheckBox( tr( "Force Depends" ), grpbox );
grplayout->addWidget( forceDepends );
@@ -71,7 +74,7 @@ InstallOptionsDlgImpl::InstallOptionsDlgImpl( int flags, int verb, QWidget * par
QLabel *l = new QLabel( tr( "Information Level" ), grpbox );
grplayout->addWidget( l );
-
+
verboseIpkg = new QComboBox( grpbox );
verboseIpkg->insertItem( tr( "Errors only" ) );
verboseIpkg->insertItem( tr( "Normal messages" ) );
@@ -79,29 +82,28 @@ InstallOptionsDlgImpl::InstallOptionsDlgImpl( int flags, int verb, QWidget * par
verboseIpkg->insertItem( tr( "Troubleshooting output" ) );
verboseIpkg->setCurrentItem( verb );
grplayout->addWidget( verboseIpkg );
-
+
grplayout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ) );
-
+
if ( flags & FORCE_DEPENDS )
- forceDepends->setChecked( true );
+ forceDepends->setChecked( true );
if ( flags & FORCE_REINSTALL )
- forceReinstall->setChecked( true );
+ forceReinstall->setChecked( true );
if ( flags & FORCE_REMOVE )
- forceRemove->setChecked( true );
+ forceRemove->setChecked( true );
if ( flags & FORCE_OVERWRITE )
- forceOverwrite->setChecked( true );
-// if ( flags & VERBOSE_WGET )
-// verboseWget->setChecked( true );
-// if ( flags & MAKE_LINKS )
-// makeLinks->setChecked( true );
+ 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()
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
@@ -1,6 +1,6 @@
/*
                This file is part of the OPIE Project
-
+
=. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk>
             .=l. Dan Williams <drw@handhelds.org>
           .>+-=
@@ -27,16 +27,27 @@
*/
-#include <linux/limits.h>
-#include <unistd.h>
+#include "categoryfilterimpl.h"
+#include "datamgr.h"
+#include "global.h"
+#include "inputdlg.h"
+#include "ipkg.h"
+#include "installdlgimpl.h"
+#include "letterpushbutton.h"
+#include "mainwin.h"
+#include "packagewin.h"
+#include "settingsimpl.h"
+#include "utils.h"
+/* OPIE */
#include <qpe/qcopenvelope_qws.h>
-#include <qmenubar.h>
#include <qpe/qpeapplication.h>
-#include <qtoolbar.h>
#include <qpe/config.h>
#include <qpe/resource.h>
+/* QT */
+#include <qmenubar.h>
+#include <qtoolbar.h>
#include <qaction.h>
#include <qcombobox.h>
#include <qfile.h>
@@ -52,22 +63,14 @@
#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 )
+ : QMainWindow( parent, name, fl || WStyle_ContextHelp )
{
// Disable suspend mode
QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::DisableSuspend;
@@ -239,7 +242,7 @@ MainWindow :: MainWindow( QWidget* parent, const char* name, WFlags fl )
MainWindow :: ~MainWindow()
{
- delete mgr;
+ delete mgr;
// Reenable suspend mode
QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
@@ -296,7 +299,7 @@ void MainWindow :: init()
Config cfg( "aqpkg" );
cfg.setGroup( "settings" );
currentlySelectedServer = cfg.readEntry( "selectedServer", "local" );
-// showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" );
+ // showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" );
#endif
@@ -337,8 +340,8 @@ void MainWindow :: setDocument( const QString &doc )
// Now set the check box of the selected package
for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
- item != 0 ;
- item = (QCheckListItem *)item->nextSibling() )
+ item != 0 ;
+ item = (QCheckListItem *)item->nextSibling() )
{
if ( item->text().startsWith( package ) )
{
@@ -354,7 +357,7 @@ void MainWindow :: displaySettings()
if ( dlg->showDlg() )
{
stack->raiseWidget( progressWindow );
- updateData();
+ updateData();
stack->raiseWidget( networkPkgWindow );
}
delete dlg;
@@ -582,12 +585,12 @@ void MainWindow :: updateData()
serversList->insertItem( serverName );
if ( serverName == currentlySelectedServer )
- activeItem = i;
- }
+ activeItem = i;
+ }
- // set selected server to be active server
- if ( activeItem != -1 )
- serversList->setCurrentItem( activeItem );
+ // set selected server to be active server
+ if ( activeItem != -1 )
+ serversList->setCurrentItem( activeItem );
serverSelected( 0, FALSE );
}
@@ -625,10 +628,10 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
packagesList->clear();
#ifdef QWS
- // read download directory from config file
- Config cfg( "aqpkg" );
- cfg.setGroup( "settings" );
- cfg.writeEntry( "selectedServer", currentlySelectedServer );
+ // read download directory from config file
+ Config cfg( "aqpkg" );
+ cfg.setGroup( "settings" );
+ cfg.writeEntry( "selectedServer", currentlySelectedServer );
#endif
int i = 0;
@@ -678,7 +681,7 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
QCheckListItem *item = new QCheckListItem( packagesList, package->getPackageName(),
- QCheckListItem::CheckBox );
+ QCheckListItem::CheckBox );
if ( package->isInstalled() )
{
@@ -738,7 +741,7 @@ void MainWindow :: searchForPackage( const QString &text )
start = (QCheckListItem *)packagesList->firstChild();
for ( QCheckListItem *item = start; item != 0 ;
- item = (QCheckListItem *)item->nextSibling() )
+ item = (QCheckListItem *)item->nextSibling() )
{
if ( item->text().lower().find( text ) != -1 )
{
@@ -766,13 +769,13 @@ void MainWindow :: updateServer()
ipkg->setOption( "update" );
InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Refreshing server package lists" ),
- tr( "Update lists" ) );
+ tr( "Update lists" ) );
connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) );
- reloadDocuments = FALSE;
+ reloadDocuments = FALSE;
stack->addWidget( dlg, 3 );
stack->raiseWidget( dlg );
-// delete progDlg;
+ // delete progDlg;
}
void MainWindow :: upgradePackages()
@@ -782,9 +785,9 @@ void MainWindow :: upgradePackages()
// TODO - ODevice????
QString text = tr( "WARNING: Upgrading while\nOpie/Qtopia is running\nis NOT recommended!\n\nAre you sure?\n" );
QMessageBox warn( tr( "Warning" ), text, QMessageBox::Warning,
- QMessageBox::Yes,
- QMessageBox::No | QMessageBox::Escape | QMessageBox::Default ,
- 0, this );
+ QMessageBox::Yes,
+ QMessageBox::No | QMessageBox::Escape | QMessageBox::Default ,
+ 0, this );
warn.adjustSize();
if ( warn.exec() == QMessageBox::Yes )
@@ -797,9 +800,9 @@ void MainWindow :: upgradePackages()
ipkg->setOption( "upgrade" );
InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Upgrading installed packages" ),
- tr ( "Upgrade" ) );
+ tr ( "Upgrade" ) );
connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) );
- reloadDocuments = TRUE;
+ reloadDocuments = TRUE;
stack->addWidget( dlg, 3 );
stack->raiseWidget( dlg );
}
@@ -815,8 +818,8 @@ void MainWindow :: downloadPackage()
if ( serversList->currentText() != LOCAL_SERVER )
{
for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
- item != 0 && !found;
- item = (QCheckListItem *)item->nextSibling() )
+ item != 0 && !found;
+ item = (QCheckListItem *)item->nextSibling() )
{
if ( item->isOn() )
found = true;
@@ -836,8 +839,8 @@ void MainWindow :: downloadPackage()
{
doUpdate = false;
for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
- item != 0 ;
- item = (QCheckListItem *)item->nextSibling() )
+ item != 0 ;
+ item = (QCheckListItem *)item->nextSibling() )
{
if ( item->isOn() )
{
@@ -855,7 +858,7 @@ void MainWindow :: downloadPackage()
QString msgtext;
msgtext = tr( "Are you sure you wish to delete\n%1?" ).arg( (const char *)p->getPackageName() );
if ( QMessageBox::information( this, tr( "Are you sure?" ),
- msgtext, tr( "No" ), tr( "Yes" ) ) == 1 )
+ msgtext, tr( "No" ), tr( "Yes" ) ) == 1 )
{
doUpdate = true;
QFile f( p->getFilename() );
@@ -908,8 +911,8 @@ void MainWindow :: downloadSelectedPackages()
ipkg.setOption( "download" );
ipkg.setRuntimeDirectory( dir );
for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
- item != 0 ;
- item = (QCheckListItem *)item->nextSibling() )
+ item != 0 ;
+ item = (QCheckListItem *)item->nextSibling() )
{
if ( item->isOn() )
{
@@ -926,12 +929,12 @@ void MainWindow :: downloadRemotePackage()
QString package = InputDialog::getText( tr( "Install Remote Package" ), tr( "Enter package location" ), "http://", &ok, this );
if ( !ok || package.isEmpty() )
return;
-// DownloadRemoteDlgImpl dlg( this, "Install", true );
-// if ( dlg.exec() == QDialog::Rejected )
-// return;
+ // DownloadRemoteDlgImpl dlg( this, "Install", true );
+ // if ( dlg.exec() == QDialog::Rejected )
+ // return;
// grab details from dialog
-// QString package = dlg.getPackageLocation();
+ // QString package = dlg.getPackageLocation();
InstallData *item = new InstallData();
item->option = "I";
@@ -942,7 +945,7 @@ void MainWindow :: downloadRemotePackage()
InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Download" ) );
connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) );
- reloadDocuments = TRUE;
+ reloadDocuments = TRUE;
stack->addWidget( dlg, 3 );
stack->raiseWidget( dlg );
}
@@ -961,8 +964,8 @@ void MainWindow :: applyChanges()
QList<InstallData> workingPackages;
workingPackages.setAutoDelete( TRUE );
for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
- item != 0 ;
- item = (QCheckListItem *)item->nextSibling() )
+ item != 0 ;
+ item = (QCheckListItem *)item->nextSibling() )
{
if ( item->isOn() )
{
@@ -971,14 +974,14 @@ void MainWindow :: applyChanges()
workingPackages.append( instdata );
else
return;
- }
+ }
}
if ( workingPackages.count() == 0 )
{
// Nothing to do
QMessageBox::information( this, tr( "Nothing to do" ),
- tr( "No packages selected" ), tr( "OK" ) );
+ tr( "No packages selected" ), tr( "OK" ) );
return;
}
@@ -986,7 +989,7 @@ void MainWindow :: applyChanges()
// do the stuff
InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Apply changes" ) );
connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) );
- reloadDocuments = TRUE;
+ reloadDocuments = TRUE;
stack->addWidget( dlg, 3 );
stack->raiseWidget( dlg );
}
@@ -1024,7 +1027,7 @@ InstallData *MainWindow :: dealWithItem( QCheckListItem *item )
// If local file, remove using package name, not filename
if ( p->isPackageStoredLocally() )
name = item->text();
-
+
if ( !p->isPackageStoredLocally() )
newitem->packageName = p->getInstalledPackageName();
else
@@ -1090,33 +1093,33 @@ InstallData *MainWindow :: dealWithItem( QCheckListItem *item )
QuestionDlg dlg( text, msgtext, secondButton );
switch( dlg.exec() )
{
- case 0: // Cancel
- delete newitem;
- return 0x0;
- break;
- case 1: // Remove
- newitem->option = "D";
- // If local file, remove using package name, not filename
- if ( p->isPackageStoredLocally() )
- name = item->text();
- break;
- case 2: // Reinstall or Upgrade
- newitem->option = secondOption;
- break;
+ case 0: // Cancel
+ delete newitem;
+ return 0x0;
+ break;
+ case 1: // Remove
+ newitem->option = "D";
+ // If local file, remove using package name, not filename
+ if ( p->isPackageStoredLocally() )
+ name = item->text();
+ break;
+ case 2: // Reinstall or Upgrade
+ newitem->option = secondOption;
+ break;
}
}
else
{
-// newitem->option = stickyOption;
+ // newitem->option = stickyOption;
}
}
// Check if we are reinstalling the same version
if ( newitem->option != "R" )
- newitem->recreateLinks = true;
+ newitem->recreateLinks = true;
else
- newitem->recreateLinks = false;
+ newitem->recreateLinks = false;
// User hit cancel (on dlg - assume remove)
return newitem;
@@ -1138,14 +1141,14 @@ void MainWindow :: reloadData( InstallDlgImpl *dlg )
#ifdef QWS
if ( reloadDocuments )
- {
- m_status->setText( tr( "Updating Launcher..." ) );
-
- // Finally let the main system update itself
- QCopEnvelope e("QPE/System", "linkChanged(QString)");
- QString lf = QString::null;
- e << lf;
- }
+ {
+ m_status->setText( tr( "Updating Launcher..." ) );
+
+ // Finally let the main system update itself
+ QCopEnvelope e("QPE/System", "linkChanged(QString)");
+ QString lf = QString::null;
+ e << lf;
+ }
#endif
stack->raiseWidget( networkPkgWindow );
@@ -1181,18 +1184,19 @@ void MainWindow :: letterPushed( QString t )
item = (QCheckListItem *)item->nextSibling();
if ( !item )
item = (QCheckListItem *)packagesList->firstChild();
- } while ( item != start);
+ }
+ while ( item != start);
}
void MainWindow :: slotDisplayPackage( QListViewItem *item )
{
QString itemstr( ((QCheckListItem*)item)->text() );
PackageWindow *p = new PackageWindow( mgr->getServer( serversList->currentText() )->getPackage( itemstr ) );
- p->showMaximized();
+ QPEApplication::showWidget( p );
}
QuestionDlg::QuestionDlg( const QString &caption, const QString &text, const QString &secondbtn )
- : QWidget( 0x0, 0x0, WType_Modal | WType_TopLevel | WStyle_Dialog )
+ : 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
@@ -24,13 +24,21 @@
    --        :-=` 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>
@@ -39,22 +47,16 @@ using namespace std;
#include <qlistbox.h>
#include <qpushbutton.h>
-#include <opie/otabwidget.h>
-
-#ifdef QWS
-#include <qpe/config.h>
-#include <qpe/resource.h>
-#endif
-
-#include "settingsimpl.h"
-
-#include "global.h"
+/* STD */
+#include <fstream>
+#include <algorithm>
+using namespace std;
SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl )
- : QDialog( parent, name, modal, fl )
+ : QDialog( parent, name, modal, fl )
{
setCaption( tr( "Configuration" ) );
-
+
// Setup layout to make everything pretty
QVBoxLayout *layout = new QVBoxLayout( this );
layout->setMargin( 2 );
@@ -68,7 +70,7 @@ SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const
tabwidget->addTab( initDestinationTab(), "aqpkg/desttab", tr( "Destinations" ) );
tabwidget->addTab( initProxyTab(), "aqpkg/proxytab", tr( "Proxies" ) );
tabwidget->setCurrentTab( tr( "Servers" ) );
-
+
dataMgr = dataManager;
setupData();
changed = false;
@@ -78,18 +80,15 @@ SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const
SettingsImpl :: ~SettingsImpl()
{
-
}
bool SettingsImpl :: showDlg()
{
- showMaximized();
- exec();
-
- if ( changed )
- dataMgr->writeOutIpkgConf();
+ QPEApplication::execDialog( this );
+ if ( changed )
+ dataMgr->writeOutIpkgConf();
- return changed;
+ return changed;
}
QWidget *SettingsImpl :: initServerTab()
@@ -118,18 +117,18 @@ QWidget *SettingsImpl :: initServerTab()
QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container );
connect( btn, SIGNAL( clicked() ), this, SLOT( newServer() ) );
layout->addWidget( btn, 1, 0 );
-
+
btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container );
connect( btn, SIGNAL( clicked() ), this, SLOT( removeServer() ) );
layout->addWidget( btn, 1, 1 );
-
+
QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Server" ), container );
grpbox->layout()->setSpacing( 2 );
grpbox->layout()->setMargin( 4 );
layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 );
QGridLayout *grplayout = new QGridLayout( grpbox->layout() );
-
+
QLabel *label = new QLabel( tr( "Name:" ), grpbox );
grplayout->addWidget( label, 0, 0 );
servername = new QLineEdit( grpbox );
@@ -142,11 +141,11 @@ QWidget *SettingsImpl :: initServerTab()
active = new QCheckBox( tr( "Active Server" ), grpbox );
grplayout->addMultiCellWidget( active, 2, 2, 0, 1 );
-
+
btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox );
connect( btn, SIGNAL( clicked() ), this, SLOT( changeServerDetails() ) );
grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 );
-
+
return control;
}
@@ -176,18 +175,18 @@ QWidget *SettingsImpl :: initDestinationTab()
QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container );
connect( btn, SIGNAL( clicked() ), this, SLOT( newDestination() ) );
layout->addWidget( btn, 1, 0 );
-
+
btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container );
connect( btn, SIGNAL( clicked() ), this, SLOT( removeDestination() ) );
layout->addWidget( btn, 1, 1 );
-
+
QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Destination" ), container );
grpbox->layout()->setSpacing( 2 );
grpbox->layout()->setMargin( 4 );
layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 );
QGridLayout *grplayout = new QGridLayout( grpbox->layout() );
-
+
QLabel *label = new QLabel( tr( "Name:" ), grpbox );
grplayout->addWidget( label, 0, 0 );
destinationname = new QLineEdit( grpbox );
@@ -200,11 +199,11 @@ QWidget *SettingsImpl :: initDestinationTab()
linkToRoot = new QCheckBox( tr( "Link to root" ), grpbox );
grplayout->addMultiCellWidget( linkToRoot, 2, 2, 0, 1 );
-
+
btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox );
connect( btn, SIGNAL( clicked() ), this, SLOT( changeDestinationDetails() ) );
grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 );
-
+
return control;
}
@@ -235,7 +234,7 @@ QWidget *SettingsImpl :: initProxyTab()
grplayout->addWidget( txtHttpProxy );
chkHttpProxyEnabled = new QCheckBox( tr( "Enabled" ), grpbox );
grplayout->addWidget( chkHttpProxyEnabled );
-
+
grpbox = new QGroupBox( 0, Qt::Vertical, tr( "FTP Proxy" ), container );
grpbox->layout()->setSpacing( 2 );
grpbox->layout()->setMargin( 4 );
@@ -245,7 +244,7 @@ QWidget *SettingsImpl :: initProxyTab()
grplayout->addWidget( txtFtpProxy );
chkFtpProxyEnabled = new QCheckBox( tr( "Enabled" ), grpbox );
grplayout->addWidget( chkFtpProxyEnabled );
-
+
QLabel *label = new QLabel( tr( "Username:" ), container );
layout->addWidget( label, 2, 0 );
txtUsername = new QLineEdit( container );
@@ -259,7 +258,7 @@ QWidget *SettingsImpl :: initProxyTab()
QPushButton *btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), container );
connect( btn, SIGNAL( clicked() ), this, SLOT( proxyApplyChanges() ) );
layout->addMultiCellWidget( btn, 4, 4, 0, 1 );
-
+
return control;
}
@@ -269,20 +268,20 @@ void SettingsImpl :: setupData()
QString serverName;
QListIterator<Server> it( dataMgr->getServerList() );
for ( ; it.current(); ++it )
- {
+ {
serverName = it.current()->getServerName();
if ( serverName == LOCAL_SERVER || serverName == LOCAL_IPKGS )
continue;
servers->insertItem( serverName );
- }
+ }
// add destinations
QListIterator<Destination> it2( dataMgr->getDestinationList() );
for ( ; it2.current(); ++it2 )
destinations->insertItem( it2.current()->getDestinationName() );
-
+
// setup proxy tab
txtHttpProxy->setText( dataMgr->getHttpProxy() );
txtFtpProxy->setText( dataMgr->getFtpProxy() );
@@ -336,53 +335,53 @@ void SettingsImpl :: removeServer()
void SettingsImpl :: changeServerDetails()
{
- changed = true;
-
- QString newName = servername->text();
-
- // Convert any spaces to underscores
- char *tmpStr = new char[newName.length() + 1];
- for ( unsigned int i = 0 ; i < newName.length() ; ++i )
- {
- if ( newName[i] == ' ' )
- tmpStr[i] = '_';
- else
- tmpStr[i] = newName[i].latin1();
- }
- tmpStr[newName.length()] = '\0';
-
- newName = tmpStr;
- delete tmpStr;
-
- if ( !newserver )
- {
- Server *s = dataMgr->getServer( servers->currentText() );
- if ( s )
- {
- // Update url
- s->setServerUrl( serverurl->text() );
- s->setActive( active->isChecked() );
-
- // Check if server name has changed, if it has then we need to replace the key in the map
- if ( serverName != newName )
- {
- // Update server name
- s->setServerName( newName );
- }
-
- // Update list box
- servers->changeItem( newName, currentSelectedServer );
- }
- }
- else
- {
+ changed = true;
+
+ QString newName = servername->text();
+
+ // Convert any spaces to underscores
+ char *tmpStr = new char[newName.length() + 1];
+ for ( unsigned int i = 0 ; i < newName.length() ; ++i )
+ {
+ if ( newName[i] == ' ' )
+ tmpStr[i] = '_';
+ else
+ tmpStr[i] = newName[i].latin1();
+ }
+ tmpStr[newName.length()] = '\0';
+
+ newName = tmpStr;
+ delete tmpStr;
+
+ if ( !newserver )
+ {
+ Server *s = dataMgr->getServer( servers->currentText() );
+ if ( s )
+ {
+ // Update url
+ s->setServerUrl( serverurl->text() );
+ s->setActive( active->isChecked() );
+
+ // Check if server name has changed, if it has then we need to replace the key in the map
+ if ( serverName != newName )
+ {
+ // Update server name
+ s->setServerName( newName );
+ }
+
+ // Update list box
+ servers->changeItem( newName, currentSelectedServer );
+ }
+ }
+ else
+ {
Server s( newName, serverurl->text() );
dataMgr->getServerList().append( new Server( newName, serverurl->text() ) );
dataMgr->getServerList().last()->setActive( active->isChecked() );
- servers->insertItem( newName );
- servers->setCurrentItem( servers->count() );
- newserver = false;
- }
+ servers->insertItem( newName );
+ servers->setCurrentItem( servers->count() );
+ newserver = false;
+ }
}
//------------------ Destinations tab ----------------------
@@ -409,10 +408,10 @@ void SettingsImpl :: editDestination( int sel )
void SettingsImpl :: newDestination()
{
- newdestination = true;
- destinationname->setText( "" );
- destinationurl->setText( "" );
- destinationname->setFocus();
+ newdestination = true;
+ destinationname->setText( "" );
+ destinationurl->setText( "" );
+ destinationname->setFocus();
linkToRoot->setChecked( true );
}
@@ -429,7 +428,7 @@ void SettingsImpl :: removeDestination()
void SettingsImpl :: changeDestinationDetails()
{
- changed = true;
+ changed = true;
#ifdef QWS
Config cfg( "aqpkg" );
@@ -437,46 +436,48 @@ void SettingsImpl :: changeDestinationDetails()
#endif
QString newName = destinationname->text();
- if ( !newdestination )
- {
- Destination *d = dataMgr->getDestination( destinations->currentText() );
- if ( d )
- {
- // Update url
- d->setDestinationPath( destinationurl->text() );
- d->linkToRoot( linkToRoot->isChecked() );
-
- // Check if server name has changed, if it has then we need to replace the key in the map
- if ( destinationName != newName )
- {
- // Update server name
- d->setDestinationName( newName );
-
- // Update list box
- destinations->changeItem( newName, currentSelectedDestination );
- }
+ if ( !newdestination )
+ {
+ Destination *d = dataMgr->getDestination( destinations->currentText() );
+ if ( d )
+ {
+ // Update url
+ d->setDestinationPath( destinationurl->text() );
+ d->linkToRoot( linkToRoot->isChecked() );
+
+ // Check if server name has changed, if it has then we need to replace the key in the map
+ if ( destinationName != newName )
+ {
+ // Update server name
+ d->setDestinationName( newName );
+
+ // Update list box
+ destinations->changeItem( newName, currentSelectedDestination );
+ }
#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;
+ 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 ----------------------
diff --git a/noncore/settings/backup/backuprestore.cpp b/noncore/settings/backup/backuprestore.cpp
index a00193d..977c283 100644
--- a/noncore/settings/backup/backuprestore.cpp
+++ b/noncore/settings/backup/backuprestore.cpp
@@ -1,11 +1,14 @@
#include "backuprestore.h"
-//#include "output.h"
#include "errordialog.h"
+/* OPIE */
+#include <opie2/ostorageinfo.h>
+#include <qpe/qpeapplication.h>
+
+/* QT */
#include <qapplication.h>
#include <qmultilineedit.h>
-
#include <qdir.h>
#include <qfile.h>
#include <qfileinfo.h>
@@ -21,8 +24,8 @@
#include <qregexp.h>
#include <qtextstream.h>
#include <qtextview.h>
-#include <opie2/ostorageinfo.h>
+/* STD */
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
@@ -41,7 +44,6 @@ const QString tempFileName = "/tmp/backup.err";
BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name, WFlags fl)
: BackupAndRestoreBase(parent, name, fl)
{
- this->showMaximized();
backupList->header()->hide();
restoreList->header()->hide();
connect(backupButton, SIGNAL(clicked()),
@@ -130,6 +132,7 @@ BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name, WFlags f
}
}
}
+ QPEApplication::showWidget( this );
}
BackupAndRestore::~BackupAndRestore()
@@ -287,8 +290,7 @@ void BackupAndRestore::backup()
{
pErrDialog->m_textarea->setText( "Unable to open File: /tmp/backup.er" );
}
- pErrDialog->showMaximized();
- pErrDialog->exec();
+ QPEApplication::execDialog( pErrDialog );
delete pErrDialog;
break;
}
@@ -452,8 +454,7 @@ void BackupAndRestore::restore()
{
pErrDialog->m_textarea->setText( tr( "Unable to open File: %1" ).arg( "/tmp/backup.er" ) );
}
- pErrDialog->showMaximized();
- pErrDialog->exec();
+ QPEApplication::execDialog( pErrDialog );
delete pErrDialog;
setCaption(tr("Backup and Restore.. Failed !!"));
diff --git a/noncore/settings/networksettings/ppp/devices.cpp b/noncore/settings/networksettings/ppp/devices.cpp
index e94904b..9da090d 100644
--- a/noncore/settings/networksettings/ppp/devices.cpp
+++ b/noncore/settings/networksettings/ppp/devices.cpp
@@ -24,25 +24,31 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include "interfaceppp.h"
+#include "devices.h"
+#include "authwidget.h"
+#include "pppdata.h"
+#include "edit.h"
+#include "general.h"
+
+/* OPIE */
+#include <qpe/qpeapplication.h>
+
+/* QT */
#include <qdir.h>
-#include <stdlib.h>
#include <qlayout.h>
#include <qtabwidget.h>
#include <qtabdialog.h>
#include <qwhatsthis.h>
#include <qmessagebox.h>
-
#include <qapplication.h>
#include <qbuttongroup.h>
#include <qmessagebox.h>
#include <qvgroupbox.h>
-#include "interfaceppp.h"
-#include "devices.h"
-#include "authwidget.h"
-#include "pppdata.h"
-#include "edit.h"
-#include "general.h"
+/* STD */
+#include <stdlib.h>
+
void parseargs(char* buf, char** args);
@@ -191,8 +197,7 @@ int DevicesWidget::doTab(){
bool ok = false;
while (!ok){
- dlg->showMaximized();
- result = dlg->exec();
+ result = QPEApplication::execDialog( dlg );
ok = true;
if(result == QDialog::Accepted) {
diff --git a/noncore/settings/networksettings/ppp/edit.cpp b/noncore/settings/networksettings/ppp/edit.cpp
index ceac90c..7d21605 100644
--- a/noncore/settings/networksettings/ppp/edit.cpp
+++ b/noncore/settings/networksettings/ppp/edit.cpp
@@ -23,8 +23,16 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include <string.h>
-#include <termios.h>
+#include "edit.h"
+#include "pppdata.h"
+#include "iplined.h"
+#include "auth.h"
+
+/* OPIE */
+#include <qpe/resource.h>
+#include <qpe/qpeapplication.h>
+
+/* QT */
#include <qlayout.h>
#include <qmessagebox.h>
#include <qwhatsthis.h>
@@ -34,189 +42,207 @@
#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)
+ : QWidget(parent, name), _pppdata(pd)
{
- const int GRIDROWS = 6;
-
- QGridLayout *tl = new QGridLayout(this, GRIDROWS, 2, 0 );
-
- connect_label = new QLabel(tr("Connection name:"), this);
- tl->addWidget(connect_label, 0, 0);
-
- connectname_l = new QLineEdit(this);
-// connectname_l->setMaxLength(ACCNAME_SIZE);
- tl->addWidget(connectname_l, 0, 1);
- QString tmp = tr("Type in a unique name for this connection");
-
- QWhatsThis::add(connect_label,tmp);
- QWhatsThis::add(connectname_l,tmp);
-
-
- number_label = new QLabel(tr("Phone number:"), this);
- number_label->setAlignment(AlignTop|AlignLeft);
- tl->addWidget(number_label, 1, 0);
-
- QHBoxLayout *lpn = new QHBoxLayout(5);
- tl->addLayout(lpn, 1, 1);
- numbers = new QListBox(this);
-// numbers->setMinimumSize(120, 70);
- lpn->addWidget(numbers);
- QVBoxLayout *lpn1 = new QVBoxLayout;
- lpn->addLayout(lpn1);
- add = new QPushButton(tr("&Add..."), this);
- del = new QPushButton(tr("&Remove"), this);
-
- up = new QPushButton(this);
- up->setPixmap( Resource::loadPixmap("up") );
- down = new QPushButton(this);
- down->setPixmap( Resource::loadPixmap("down") );
- lpn1->addWidget(add);
- lpn1->addWidget(del);
- lpn1->addStretch(1);
- lpn1->addWidget(up);
- lpn1->addWidget(down);
- connect(add, SIGNAL(clicked()),
- this, SLOT(addNumber()));
- connect(del, SIGNAL(clicked()),
- this, SLOT(delNumber()));
- connect(up, SIGNAL(clicked()),
- this, SLOT(upNumber()));
- connect(down, SIGNAL(clicked()),
- this, SLOT(downNumber()));
- connect(numbers, SIGNAL(highlighted(int)),
- this, SLOT(selectionChanged(int)));
- numbersChanged();
-
- tmp = tr("<p>Specifies the phone numbers to dial. You\n"
- "can supply multiple numbers here, simply\n"
- "click on \"Add\". You can arrange the\n"
- "order the numbers are tried by using the\n"
- "arrow buttons.\n\n"
- "When a number is busy or fails, <i>kppp</i> will \n"
- "try the next number and so on");
-
- 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) {
- 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] == ':') {
- if(tmp.length() > 0)
- numbers->insertItem(tmp);
- tmp = "";
- } else
- tmp += n[idx];
- idx++;
- }
- if(tmp.length() > 0)
- numbers->insertItem(tmp);
+ const int GRIDROWS = 6;
+
+ QGridLayout *tl = new QGridLayout(this, GRIDROWS, 2, 0 );
+
+ connect_label = new QLabel(tr("Connection name:"), this);
+ tl->addWidget(connect_label, 0, 0);
+
+ connectname_l = new QLineEdit(this);
+ // connectname_l->setMaxLength(ACCNAME_SIZE);
+ tl->addWidget(connectname_l, 0, 1);
+ QString tmp = tr("Type in a unique name for this connection");
+
+ QWhatsThis::add(connect_label,tmp);
+ QWhatsThis::add(connectname_l,tmp);
+
+
+ number_label = new QLabel(tr("Phone number:"), this);
+ number_label->setAlignment(AlignTop|AlignLeft);
+ tl->addWidget(number_label, 1, 0);
+
+ QHBoxLayout *lpn = new QHBoxLayout(5);
+ tl->addLayout(lpn, 1, 1);
+ numbers = new QListBox(this);
+ // numbers->setMinimumSize(120, 70);
+ lpn->addWidget(numbers);
+ QVBoxLayout *lpn1 = new QVBoxLayout;
+ lpn->addLayout(lpn1);
+ add = new QPushButton(tr("&Add..."), this);
+ del = new QPushButton(tr("&Remove"), this);
+
+ up = new QPushButton(this);
+ up->setPixmap( Resource::loadPixmap("up") );
+ down = new QPushButton(this);
+ down->setPixmap( Resource::loadPixmap("down") );
+ lpn1->addWidget(add);
+ lpn1->addWidget(del);
+ lpn1->addStretch(1);
+ lpn1->addWidget(up);
+ lpn1->addWidget(down);
+ connect(add, SIGNAL(clicked()),
+ this, SLOT(addNumber()));
+ connect(del, SIGNAL(clicked()),
+ this, SLOT(delNumber()));
+ connect(up, SIGNAL(clicked()),
+ this, SLOT(upNumber()));
+ connect(down, SIGNAL(clicked()),
+ this, SLOT(downNumber()));
+ connect(numbers, SIGNAL(highlighted(int)),
+ this, SLOT(selectionChanged(int)));
+ numbersChanged();
+
+ tmp = tr("<p>Specifies the phone numbers to dial. You\n"
+ "can supply multiple numbers here, simply\n"
+ "click on \"Add\". You can arrange the\n"
+ "order the numbers are tried by using the\n"
+ "arrow buttons.\n\n"
+ "When a number is busy or fails, <i>kppp</i> will \n"
+ "try the next number and so on");
- }
+ 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)
+ {
+ 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] == ':')
+ {
+ if(tmp.length() > 0)
+ numbers->insertItem(tmp);
+ tmp = "";
+ }
+ else
+ tmp += n[idx];
+ idx++;
+ }
+ if(tmp.length() > 0)
+ numbers->insertItem(tmp);
- numbersChanged();
- tl->activate();
+ }
+
+ numbersChanged();
+ tl->activate();
}
-bool DialWidget::save() {
- //first check to make sure that the account name is unique!
- if(connectname_l->text().isEmpty() ||
- !_pppdata->isUniqueAccname(connectname_l->text())) {
- return false;
- } else {
- _pppdata->setAccname(connectname_l->text());
-
- QString number = "";
- for(uint i = 0; i < numbers->count(); i++) {
- if(i != 0)
- number += ":";
- number += numbers->text(i);
+bool DialWidget::save()
+{
+ //first check to make sure that the account name is unique!
+ if(connectname_l->text().isEmpty() ||
+ !_pppdata->isUniqueAccname(connectname_l->text()))
+ {
+ return false;
}
+ else
+ {
+ _pppdata->setAccname(connectname_l->text());
+
+ QString number = "";
+ for(uint i = 0; i < numbers->count(); i++)
+ {
+ if(i != 0)
+ number += ":";
+ number += numbers->text(i);
+ }
- _pppdata->setPhonenumber(number);
- return true;
- }
+ _pppdata->setPhonenumber(number);
+ return true;
+ }
}
-void DialWidget::numbersChanged() {
- int sel = numbers->currentItem();
+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);
+ del->setEnabled(sel != -1);
+ up->setEnabled(sel != -1 && sel != 0);
+ down->setEnabled(sel != -1 && sel != (int)numbers->count()-1);
}
-void DialWidget::selectionChanged(int) {
- numbersChanged();
+void DialWidget::selectionChanged(int)
+{
+ numbersChanged();
}
-void DialWidget::addNumber() {
+void DialWidget::addNumber()
+{
PhoneNumberDialog dlg(this);
- if(dlg.exec()) {
- numbers->insertItem(dlg.phoneNumber());
- numbersChanged();
- }
+ if(dlg.exec())
+ {
+ numbers->insertItem(dlg.phoneNumber());
+ numbersChanged();
+ }
}
-void DialWidget::delNumber() {
- if(numbers->currentItem() != -1) {
- numbers->removeItem(numbers->currentItem());
- numbersChanged();
- }
+void DialWidget::delNumber()
+{
+ if(numbers->currentItem() != -1)
+ {
+ numbers->removeItem(numbers->currentItem());
+ numbersChanged();
+ }
}
-void DialWidget::upNumber() {
- int idx = numbers->currentItem();
- if(idx != -1) {
- QString item = numbers->text(idx);
- numbers->removeItem(idx);
- numbers->insertItem(item, idx-1);
- numbers->setCurrentItem(idx-1);
- numbersChanged();
- }
+void DialWidget::upNumber()
+{
+ int idx = numbers->currentItem();
+ if(idx != -1)
+ {
+ QString item = numbers->text(idx);
+ numbers->removeItem(idx);
+ numbers->insertItem(item, idx-1);
+ numbers->setCurrentItem(idx-1);
+ numbersChanged();
+ }
}
-void DialWidget::downNumber() {
- int idx = numbers->currentItem();
- if(idx != -1) {
- QString item = numbers->text(idx);
- numbers->removeItem(idx);
- numbers->insertItem(item, idx+1);
- numbers->setCurrentItem(idx+1);
- numbersChanged();
- }
+void DialWidget::downNumber()
+{
+ int idx = numbers->currentItem();
+ 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 );
}
@@ -225,101 +251,103 @@ void DialWidget::pppdargsbutton() {
// ExecWidget
/////////////////////////////////////////////////////////////////////////////
ExecWidget::ExecWidget(PPPData *pd, QWidget *parent, bool isnewaccount, const char *name) :
- QWidget(parent, name), _pppdata(pd)
+ QWidget(parent, name), _pppdata(pd)
{
QVBoxLayout *tl = new QVBoxLayout(this, 0 );//, KDialog::spacingHint());
- QLabel *l = new QLabel( tr("Here you can select commands to run at certain stages of the connection. The commands are run with your real user id, so you cannot run any commands here requiring root permissions (unless, of course, you are root).<br><br>Be sure to supply the whole path to the program otherwise we might be unable to find it."), this);
-
- tl->addWidget(l);
- tl->addStretch(1);
-
- QGridLayout *l1 = new QGridLayout(4, 2, 10);
- tl->addLayout(l1);
- l1->setColStretch(0, 0);
- l1->setColStretch(1, 1);
-
- before_connect_l = new QLabel(tr("Before connect:"), this);
- before_connect_l->setAlignment(AlignVCenter);
- l1->addWidget(before_connect_l, 0, 0);
- before_connect = new QLineEdit(this);
-// before_connect->setMaxLength(COMMAND_SIZE);
- l1->addWidget(before_connect, 0, 1);
- QString tmp = tr("Allows you to run a program <b>before</b> a connection\n"
- "is established. It is called immediately before\n"
- "dialing has begun.\n\n"
- "This might be useful, e.g. to stop HylaFAX blocking the\n"
- "modem.");
-
- QWhatsThis::add(before_connect_l,tmp);
- QWhatsThis::add(before_connect,tmp);
-
- command_label = new QLabel(tr("Upon connect:"), this);
- command_label->setAlignment(AlignVCenter);
- l1->addWidget(command_label, 1, 0);
- command = new QLineEdit(this);
-// command->setMaxLength(COMMAND_SIZE);
- l1->addWidget(command, 1, 1);
- tmp = tr("Allows you to run a program <b>after</b> a connection\n"
- "is established. When your program is called, all\n"
- "preparations for an Internet connection are finished.\n"
- "\n"
- "Very useful for fetching mail and news");
-
- QWhatsThis::add(command_label,tmp);
- QWhatsThis::add(command,tmp);
-
- predisconnect_label = new QLabel(tr("Before disconnect:"),
- this);
- predisconnect_label->setAlignment(AlignVCenter);
- l1->addWidget(predisconnect_label, 2, 0);
- predisconnect = new QLineEdit(this);
-// predisconnect->setMaxLength(COMMAND_SIZE);
- l1->addWidget(predisconnect, 2, 1);
- tmp = tr("Allows you to run a program <b>before</b> a connection\n"
- "is closed. The connection will stay open until\n"
- "the program exits.");
-
- QWhatsThis::add(predisconnect_label,tmp);
- QWhatsThis::add(predisconnect,tmp);
-
- discommand_label = new QLabel(tr("Upon disconnect:"),
- this);
- discommand_label->setAlignment(AlignVCenter);
- l1->addWidget(discommand_label, 3, 0);
-
- discommand = new QLineEdit(this);
-// discommand->setMaxLength(COMMAND_SIZE);
- l1->addWidget(discommand, 3, 1);
- tmp = tr("Allows you to run a program <b>after</b> a connection\n"
- "has been closed.");
-
- QWhatsThis::add(discommand_label,tmp);
- QWhatsThis::add(discommand,tmp);
-
- // 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) {
- 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());
- }
+ QLabel *l = new QLabel( tr("Here you can select commands to run at certain stages of the connection. The commands are run with your real user id, so you cannot run any commands here requiring root permissions (unless, of course, you are root).<br><br>Be sure to supply the whole path to the program otherwise we might be unable to find it."), this);
+
+ tl->addWidget(l);
+ tl->addStretch(1);
+
+ QGridLayout *l1 = new QGridLayout(4, 2, 10);
+ tl->addLayout(l1);
+ l1->setColStretch(0, 0);
+ l1->setColStretch(1, 1);
+
+ before_connect_l = new QLabel(tr("Before connect:"), this);
+ before_connect_l->setAlignment(AlignVCenter);
+ l1->addWidget(before_connect_l, 0, 0);
+ before_connect = new QLineEdit(this);
+ // before_connect->setMaxLength(COMMAND_SIZE);
+ l1->addWidget(before_connect, 0, 1);
+ QString tmp = tr("Allows you to run a program <b>before</b> a connection\n"
+ "is established. It is called immediately before\n"
+ "dialing has begun.\n\n"
+ "This might be useful, e.g. to stop HylaFAX blocking the\n"
+ "modem.");
+
+ QWhatsThis::add(before_connect_l,tmp);
+ QWhatsThis::add(before_connect,tmp);
+
+ command_label = new QLabel(tr("Upon connect:"), this);
+ command_label->setAlignment(AlignVCenter);
+ l1->addWidget(command_label, 1, 0);
+ command = new QLineEdit(this);
+ // command->setMaxLength(COMMAND_SIZE);
+ l1->addWidget(command, 1, 1);
+ tmp = tr("Allows you to run a program <b>after</b> a connection\n"
+ "is established. When your program is called, all\n"
+ "preparations for an Internet connection are finished.\n"
+ "\n"
+ "Very useful for fetching mail and news");
+
+ QWhatsThis::add(command_label,tmp);
+ QWhatsThis::add(command,tmp);
+
+ predisconnect_label = new QLabel(tr("Before disconnect:"),
+ this);
+ predisconnect_label->setAlignment(AlignVCenter);
+ l1->addWidget(predisconnect_label, 2, 0);
+ predisconnect = new QLineEdit(this);
+ // predisconnect->setMaxLength(COMMAND_SIZE);
+ l1->addWidget(predisconnect, 2, 1);
+ tmp = tr("Allows you to run a program <b>before</b> a connection\n"
+ "is closed. The connection will stay open until\n"
+ "the program exits.");
+
+ QWhatsThis::add(predisconnect_label,tmp);
+ QWhatsThis::add(predisconnect,tmp);
+
+ discommand_label = new QLabel(tr("Upon disconnect:"),
+ this);
+ discommand_label->setAlignment(AlignVCenter);
+ l1->addWidget(discommand_label, 3, 0);
+
+ discommand = new QLineEdit(this);
+ // discommand->setMaxLength(COMMAND_SIZE);
+ l1->addWidget(discommand, 3, 1);
+ tmp = tr("Allows you to run a program <b>after</b> a connection\n"
+ "has been closed.");
+
+ QWhatsThis::add(discommand_label,tmp);
+ QWhatsThis::add(discommand,tmp);
+
+ // 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)
+ {
+ 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() {
- _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;
+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;
}
@@ -330,339 +358,360 @@ bool ExecWidget::save() {
//
/////////////////////////////////////////////////////////////////////////////
IPWidget::IPWidget( PPPData *pd, QWidget *parent, bool isnewaccount, const char *name )
- : QWidget(parent, name), _pppdata(pd)
+ : QWidget(parent, name), _pppdata(pd)
{
- QVBoxLayout *topLayout = new QVBoxLayout(this);
- topLayout->setSpacing( 3 );//KDialog::spacingHint());
-
- box = new QVGroupBox(tr("Configuration"), this);
-// box->setInsideSpacing( 1 );//KDialog::spacingHint());
-
- rb = new QButtonGroup(this);
- rb->hide();
- connect(rb, SIGNAL(clicked(int)),
- SLOT(hitIPSelect(int)));
-
- dynamicadd_rb = new QRadioButton(box);
- dynamicadd_rb->setText(tr("Dynamic IP address"));
- QWhatsThis::add(dynamicadd_rb,
- tr("Select this option when your computer gets an\n"
- "internet address (IP) every time a\n"
- "connection is made.\n"
- "\n"
- "Almost every Internet Service Provider uses\n"
- "this method, so this should be turned on."));
-
- staticadd_rb = new QRadioButton(box);
- staticadd_rb->setText(tr("Static IP address"));
- rb->insert(dynamicadd_rb, 0);
- rb->insert(staticadd_rb, 1);
- QWhatsThis::add(staticadd_rb,
- tr("Select this option when your computer has a\n"
- "fixed internet address (IP). Most computers\n"
- "don't have this, so you should probably select\n"
- "dynamic IP addressing unless you know what you\n"
- "are doing."));
-
- QWidget *ipWidget = new QWidget(box);
- QGridLayout *ipLayout = new QGridLayout(ipWidget, 2, 2);
- ipLayout->setSpacing( 2 );//KDialog::spacingHint());
-
- ipaddress_label = new QLabel(tr("IP address:"), ipWidget);
- QString tmp = tr("If your computer has a permanent internet\n"
- "address, you must supply your IP address here.");
- ipLayout->addWidget(ipaddress_label, 0, 0);
-
- ipaddress_l = new IPLineEdit(ipWidget);
- ipLayout->addWidget(ipaddress_l, 0, 1);
-
- QWhatsThis::add(ipaddress_label,tmp);
- QWhatsThis::add(ipaddress_l,tmp);
-
- sub_label = new QLabel(tr("Subnet mask:"), ipWidget);
- tmp = tr("<p>If your computer has a static Internet address,\n"
- "you must supply a network mask here. In almost\n"
- "all cases this netmask will be <b>255.255.255.0</b>,\n"
- "but your mileage may vary.\n"
- "\n"
- "If unsure, contact your Internet Service Provider");
- ipLayout->addWidget(sub_label, 1, 0);
-
- subnetmask_l = new IPLineEdit(ipWidget);
- ipLayout->addWidget(subnetmask_l, 1, 1);
-
- QWhatsThis::add(sub_label,tmp);
- QWhatsThis::add(subnetmask_l,tmp);
-
- autoname = new QCheckBox(tr("Auto-configure hostname from this IP"), this);
- autoname->setChecked(_pppdata->autoname());
- connect(autoname,SIGNAL(toggled(bool)),
- this,SLOT(autoname_t(bool)));
-
- QWhatsThis::add(autoname,
- tr("<p>Whenever you connect, this reconfigures\n"
- "your hostname to match the IP address you\n"
- "got from the PPP server. This may be useful\n"
- "if you need to use a protocol which depends\n"
- "on this information, but it can also cause several\n"
- "<a href=\"kppp-7.html#autohostname\">problems</a>.\n"
- "\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(_pppdata->ipaddr() == "0.0.0.0" &&
- _pppdata->subnetmask() == "0.0.0.0") {
- dynamicadd_rb->setChecked(true);
- hitIPSelect(0);
- autoname->setChecked(_pppdata->autoname());
+ QVBoxLayout *topLayout = new QVBoxLayout(this);
+ topLayout->setSpacing( 3 );//KDialog::spacingHint());
+
+ box = new QVGroupBox(tr("Configuration"), this);
+ // box->setInsideSpacing( 1 );//KDialog::spacingHint());
+
+ rb = new QButtonGroup(this);
+ rb->hide();
+ connect(rb, SIGNAL(clicked(int)),
+ SLOT(hitIPSelect(int)));
+
+ dynamicadd_rb = new QRadioButton(box);
+ dynamicadd_rb->setText(tr("Dynamic IP address"));
+ QWhatsThis::add(dynamicadd_rb,
+ tr("Select this option when your computer gets an\n"
+ "internet address (IP) every time a\n"
+ "connection is made.\n"
+ "\n"
+ "Almost every Internet Service Provider uses\n"
+ "this method, so this should be turned on."));
+
+ staticadd_rb = new QRadioButton(box);
+ staticadd_rb->setText(tr("Static IP address"));
+ rb->insert(dynamicadd_rb, 0);
+ rb->insert(staticadd_rb, 1);
+ QWhatsThis::add(staticadd_rb,
+ tr("Select this option when your computer has a\n"
+ "fixed internet address (IP). Most computers\n"
+ "don't have this, so you should probably select\n"
+ "dynamic IP addressing unless you know what you\n"
+ "are doing."));
+
+ QWidget *ipWidget = new QWidget(box);
+ QGridLayout *ipLayout = new QGridLayout(ipWidget, 2, 2);
+ ipLayout->setSpacing( 2 );//KDialog::spacingHint());
+
+ ipaddress_label = new QLabel(tr("IP address:"), ipWidget);
+ QString tmp = tr("If your computer has a permanent internet\n"
+ "address, you must supply your IP address here.");
+ ipLayout->addWidget(ipaddress_label, 0, 0);
+
+ ipaddress_l = new IPLineEdit(ipWidget);
+ ipLayout->addWidget(ipaddress_l, 0, 1);
+
+ QWhatsThis::add(ipaddress_label,tmp);
+ QWhatsThis::add(ipaddress_l,tmp);
+
+ sub_label = new QLabel(tr("Subnet mask:"), ipWidget);
+ tmp = tr("<p>If your computer has a static Internet address,\n"
+ "you must supply a network mask here. In almost\n"
+ "all cases this netmask will be <b>255.255.255.0</b>,\n"
+ "but your mileage may vary.\n"
+ "\n"
+ "If unsure, contact your Internet Service Provider");
+ ipLayout->addWidget(sub_label, 1, 0);
+
+ subnetmask_l = new IPLineEdit(ipWidget);
+ ipLayout->addWidget(subnetmask_l, 1, 1);
+
+ QWhatsThis::add(sub_label,tmp);
+ QWhatsThis::add(subnetmask_l,tmp);
+
+ autoname = new QCheckBox(tr("Auto-configure hostname from this IP"), this);
+ autoname->setChecked(_pppdata->autoname());
+ connect(autoname,SIGNAL(toggled(bool)),
+ this,SLOT(autoname_t(bool)));
+
+ QWhatsThis::add(autoname,
+ tr("<p>Whenever you connect, this reconfigures\n"
+ "your hostname to match the IP address you\n"
+ "got from the PPP server. This may be useful\n"
+ "if you need to use a protocol which depends\n"
+ "on this information, but it can also cause several\n"
+ "<a href=\"kppp-7.html#autohostname\">problems</a>.\n"
+ "\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(_pppdata->ipaddr() == "0.0.0.0" &&
+ _pppdata->subnetmask() == "0.0.0.0")
+ {
+ dynamicadd_rb->setChecked(true);
+ hitIPSelect(0);
+ autoname->setChecked(_pppdata->autoname());
+ }
+ else
+ {
+ ipaddress_l->setText(_pppdata->ipaddr());
+ subnetmask_l->setText(_pppdata->subnetmask());
+ staticadd_rb->setChecked(true);
+ autoname->setChecked(false);
+ }
}
- else {
- ipaddress_l->setText(_pppdata->ipaddr());
- subnetmask_l->setText(_pppdata->subnetmask());
- staticadd_rb->setChecked(true);
- autoname->setChecked(false);
+ else
+ {
+ dynamicadd_rb->setChecked(true);
+ hitIPSelect(0);
}
- }
- else {
- dynamicadd_rb->setChecked(true);
- hitIPSelect(0);
- }
}
-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) {
- 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::autoname_t(bool on)
+{
+ static bool was_warned = false;
+
+ // big-fat warning when selecting the auto configure hostname option
+ 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()) {
- _pppdata->setIpaddr("0.0.0.0");
- _pppdata->setSubnetmask("0.0.0.0");
- } else {
- _pppdata->setIpaddr(ipaddress_l->text());
- _pppdata->setSubnetmask(subnetmask_l->text());
- }
- _pppdata->setAutoname(autoname->isChecked());
+void IPWidget::save()
+{
+ if(dynamicadd_rb->isChecked())
+ {
+ _pppdata->setIpaddr("0.0.0.0");
+ _pppdata->setSubnetmask("0.0.0.0");
+ }
+ else
+ {
+ _pppdata->setIpaddr(ipaddress_l->text());
+ _pppdata->setSubnetmask(subnetmask_l->text());
+ }
+ _pppdata->setAutoname(autoname->isChecked());
}
-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 {
- ipaddress_label->setEnabled(true);
- sub_label->setEnabled(true);
- ipaddress_l->setEnabled(true);
- subnetmask_l->setEnabled(true);
- }
+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
+ {
+ ipaddress_label->setEnabled(true);
+ sub_label->setEnabled(true);
+ ipaddress_l->setEnabled(true);
+ subnetmask_l->setEnabled(true);
+ }
}
DNSWidget::DNSWidget( PPPData *pd, QWidget *parent, bool isnewaccount, const char *name )
- : QWidget(parent, name), _pppdata(pd)
+ : QWidget(parent, name), _pppdata(pd)
{
QGridLayout *tl = new QGridLayout(this, 7, 2, 0 );
- dnsdomain_label = new QLabel(tr("Domain name:"), this);
- tl->addWidget(dnsdomain_label, 0, 0);
-
- dnsdomain = new QLineEdit(this);
-
- tl->addWidget(dnsdomain, 0, 1);
- QString tmp = tr("If you enter a domain name here, this domain\n"
- "name is used for your computer while you are\n"
- "connected. When the connection is closed, the\n"
- "original domain name of your computer is\n"
- "restored.\n"
- "\n"
- "If you leave this field blank, no changes are\n"
- "made to the domain name.");
-
- QWhatsThis::add(dnsdomain_label,tmp);
- QWhatsThis::add(dnsdomain,tmp);
-
- conf_label = new QLabel(tr("Configuration:"), this);
- tl->addWidget(conf_label, 1, 0);
-
- bg = new QButtonGroup("Group", this);
- connect(bg, SIGNAL(clicked(int)), SLOT(DNS_Mode_Selected(int)));
- bg->hide();
-
- autodns = new QRadioButton(tr("Automatic"), this);
- bg->insert(autodns, 0);
- tl->addWidget(autodns, 1, 1);
- if(!_pppdata->pppdVersionMin(2, 3, 7))
- autodns->setEnabled(false);
-
- mandns = new QRadioButton(tr("Manual"), this);
- bg->insert(mandns, 1);
- tl->addWidget(mandns, 2, 1);
-
- dns_label = new QLabel(tr("DNS IP address:"), this);
- tl->addWidget(dns_label, 3, 0);
-
- QHBoxLayout *l2 = new QHBoxLayout;
- tl->addLayout(l2, 3, 1);
- dnsipaddr = new IPLineEdit(this);
- connect(dnsipaddr, SIGNAL(returnPressed()),
- SLOT(adddns()));
- connect(dnsipaddr, SIGNAL(textChanged(const QString &)),
- SLOT(DNS_Edit_Changed(const QString &)));
- l2->addWidget(dnsipaddr, 1);
- l2->addStretch(1);
- tmp = tr("<p>Allows you to specify a new DNS server to be\n"
- "used while you are connected. When the\n"
- "connection is closed, this DNS entry will be\n"
- "removed again.\n"
- "\n"
- "To add a DNS server, type in the IP address of\n"
- "the DNS server here and click on <b>Add</b>");
-
- QWhatsThis::add(dns_label, tmp);
- QWhatsThis::add(dnsipaddr, tmp);
-
- QHBoxLayout *l1 = new QHBoxLayout;
- tl->addLayout(l1, 4, 1);
- add = new QPushButton(tr("Add"), this);
- connect(add, SIGNAL(clicked()), SLOT(adddns()));
- l1->addWidget(add);
-// l1->addStretch(1);
- QWhatsThis::add(add,
- tr("Click this button to add the DNS server\n"
- "specified in the field above. The entry\n"
- "will then be added to the list below"));
-
- remove = new QPushButton(tr("Remove"), this);
- connect(remove, SIGNAL(clicked()), SLOT(removedns()));
- l1->addWidget(remove);
- QWhatsThis::add(remove,
- tr("Click this button to remove the selected DNS\n"
- "server entry from the list below"));
-
- servers_label = new QLabel(tr("DNS address list:"), this);
- servers_label->setAlignment(AlignTop|AlignLeft);
- tl->addWidget(servers_label, 5, 0);
-
- dnsservers = new QListBox(this);
- dnsservers->setMinimumSize(150, 80);
- connect(dnsservers, SIGNAL(highlighted(int)),
- SLOT(DNS_Entry_Selected(int)));
- tl->addWidget(dnsservers, 5, 1);
- tmp = tr("<p>This shows all defined DNS servers to use\n"
- "while you are connected. Use the <b>Add</b> and\n"
- "<b>Remove</b> buttons to modify the list");
-
- QWhatsThis::add(servers_label,tmp);
- QWhatsThis::add(dnsservers,tmp);
-
- exdnsdisabled_toggle = new QCheckBox(tr("Disable DNS servers during connection"), this);
- // exdnsdisabled_toggle = new QCheckBox(tr("Disable existing DNS servers during connection"), this);
- exdnsdisabled_toggle->setChecked(_pppdata->exDNSDisabled());
- tl->addMultiCellWidget(exdnsdisabled_toggle, 6, 6, 0, 1, AlignCenter);
- QWhatsThis::add(exdnsdisabled_toggle,
- tr("<p>When this option is selected, all DNS\n"
- "servers specified in <tt>/etc/resolv.conf</tt> are\n"
- "temporary disabled while the dialup connection\n"
- "is established. After the connection is\n"
- "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) {
- dnsservers->insertStringList(_pppdata->dns());
- dnsdomain->setText(_pppdata->domain());
- }
-
- int mode = _pppdata->autoDNS() ? 0 : 1;
- bg->setButton(mode);
- DNS_Mode_Selected(mode);
-
- tl->activate();
+ dnsdomain_label = new QLabel(tr("Domain name:"), this);
+ tl->addWidget(dnsdomain_label, 0, 0);
+
+ dnsdomain = new QLineEdit(this);
+
+ tl->addWidget(dnsdomain, 0, 1);
+ QString tmp = tr("If you enter a domain name here, this domain\n"
+ "name is used for your computer while you are\n"
+ "connected. When the connection is closed, the\n"
+ "original domain name of your computer is\n"
+ "restored.\n"
+ "\n"
+ "If you leave this field blank, no changes are\n"
+ "made to the domain name.");
+
+ QWhatsThis::add(dnsdomain_label,tmp);
+ QWhatsThis::add(dnsdomain,tmp);
+
+ conf_label = new QLabel(tr("Configuration:"), this);
+ tl->addWidget(conf_label, 1, 0);
+
+ bg = new QButtonGroup("Group", this);
+ connect(bg, SIGNAL(clicked(int)), SLOT(DNS_Mode_Selected(int)));
+ bg->hide();
+
+ autodns = new QRadioButton(tr("Automatic"), this);
+ bg->insert(autodns, 0);
+ tl->addWidget(autodns, 1, 1);
+ if(!_pppdata->pppdVersionMin(2, 3, 7))
+ autodns->setEnabled(false);
+
+ mandns = new QRadioButton(tr("Manual"), this);
+ bg->insert(mandns, 1);
+ tl->addWidget(mandns, 2, 1);
+
+ dns_label = new QLabel(tr("DNS IP address:"), this);
+ tl->addWidget(dns_label, 3, 0);
+
+ QHBoxLayout *l2 = new QHBoxLayout;
+ tl->addLayout(l2, 3, 1);
+ dnsipaddr = new IPLineEdit(this);
+ connect(dnsipaddr, SIGNAL(returnPressed()),
+ SLOT(adddns()));
+ connect(dnsipaddr, SIGNAL(textChanged(const QString &)),
+ SLOT(DNS_Edit_Changed(const QString &)));
+ l2->addWidget(dnsipaddr, 1);
+ l2->addStretch(1);
+ tmp = tr("<p>Allows you to specify a new DNS server to be\n"
+ "used while you are connected. When the\n"
+ "connection is closed, this DNS entry will be\n"
+ "removed again.\n"
+ "\n"
+ "To add a DNS server, type in the IP address of\n"
+ "the DNS server here and click on <b>Add</b>");
+
+ QWhatsThis::add(dns_label, tmp);
+ QWhatsThis::add(dnsipaddr, tmp);
+
+ QHBoxLayout *l1 = new QHBoxLayout;
+ tl->addLayout(l1, 4, 1);
+ add = new QPushButton(tr("Add"), this);
+ connect(add, SIGNAL(clicked()), SLOT(adddns()));
+ l1->addWidget(add);
+ // l1->addStretch(1);
+ QWhatsThis::add(add,
+ tr("Click this button to add the DNS server\n"
+ "specified in the field above. The entry\n"
+ "will then be added to the list below"));
+
+ remove = new QPushButton(tr("Remove"), this);
+ connect(remove, SIGNAL(clicked()), SLOT(removedns()));
+ l1->addWidget(remove);
+ QWhatsThis::add(remove,
+ tr("Click this button to remove the selected DNS\n"
+ "server entry from the list below"));
+
+ servers_label = new QLabel(tr("DNS address list:"), this);
+ servers_label->setAlignment(AlignTop|AlignLeft);
+ tl->addWidget(servers_label, 5, 0);
+
+ dnsservers = new QListBox(this);
+ dnsservers->setMinimumSize(150, 80);
+ connect(dnsservers, SIGNAL(highlighted(int)),
+ SLOT(DNS_Entry_Selected(int)));
+ tl->addWidget(dnsservers, 5, 1);
+ tmp = tr("<p>This shows all defined DNS servers to use\n"
+ "while you are connected. Use the <b>Add</b> and\n"
+ "<b>Remove</b> buttons to modify the list");
+
+ QWhatsThis::add(servers_label,tmp);
+ QWhatsThis::add(dnsservers,tmp);
+
+ exdnsdisabled_toggle = new QCheckBox(tr("Disable DNS servers during connection"), this);
+ // exdnsdisabled_toggle = new QCheckBox(tr("Disable existing DNS servers during connection"), this);
+ exdnsdisabled_toggle->setChecked(_pppdata->exDNSDisabled());
+ tl->addMultiCellWidget(exdnsdisabled_toggle, 6, 6, 0, 1, AlignCenter);
+ QWhatsThis::add(exdnsdisabled_toggle,
+ tr("<p>When this option is selected, all DNS\n"
+ "servers specified in <tt>/etc/resolv.conf</tt> are\n"
+ "temporary disabled while the dialup connection\n"
+ "is established. After the connection is\n"
+ "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)
+ {
+ 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) {
- QRegExp r("[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+");
- add->setEnabled(text.find(r) != -1);
+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) {
- remove->setEnabled(true);
+void DNSWidget::DNS_Entry_Selected(int)
+{
+ remove->setEnabled(true);
}
-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::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() {
- _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());
- if(s.left(1) == ".")
- _pppdata->setDomain(s.mid(1));
- else
- _pppdata->setDomain(dnsdomain->text());
-
- _pppdata->setExDNSDisabled(exdnsdisabled_toggle->isChecked());
+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());
+ if(s.left(1) == ".")
+ _pppdata->setDomain(s.mid(1));
+ else
+ _pppdata->setDomain(dnsdomain->text());
+
+ _pppdata->setExDNSDisabled(exdnsdisabled_toggle->isChecked());
}
-void DNSWidget::adddns() {
- if(dnsservers->count() < MAX_DNS_ENTRIES) {
- dnsservers->insertItem(dnsipaddr->text());
- dnsipaddr->setText("");
- }
+void DNSWidget::adddns()
+{
+ if(dnsservers->count() < MAX_DNS_ENTRIES)
+ {
+ dnsservers->insertItem(dnsipaddr->text());
+ dnsipaddr->setText("");
+ }
}
-void DNSWidget::removedns() {
- int i;
- i = dnsservers->currentItem();
- if(i != -1)
- dnsservers->removeItem(i);
- remove->setEnabled(dnsservers->count()>0);
+void DNSWidget::removedns()
+{
+ int i;
+ i = dnsservers->currentItem();
+ if(i != -1)
+ dnsservers->removeItem(i);
+ remove->setEnabled(dnsservers->count()>0);
}
@@ -670,415 +719,441 @@ void DNSWidget::removedns() {
// GatewayWidget
//
GatewayWidget::GatewayWidget( PPPData *pd, QWidget *parent, bool isnewaccount, const char *name )
- : QWidget(parent, name), _pppdata(pd)
+ : QWidget(parent, name), _pppdata(pd)
{
- QVBoxLayout *topLayout = new QVBoxLayout(this);
- topLayout->setSpacing( 2 );
- topLayout->setMargin( 0 );
-
- box = new QVGroupBox(tr("Configuration"), this);
-
- rb = new QButtonGroup(this);
- rb->hide();
- connect(rb, SIGNAL(clicked(int)), SLOT(hitGatewaySelect(int)));
-
- defaultgateway = new QRadioButton(box);
- defaultgateway->setText(tr("Default gateway"));
- rb->insert(defaultgateway, 0);
- QWhatsThis::add(defaultgateway,
- tr("This makes the PPP peer computer (the computer\n"
- "you are connected to with your modem) to act as\n"
- "a gateway. Your computer will send all packets not\n"
- "going to a computer inside your local net to this\n"
- "computer, which will route these packets.\n"
- "\n"
- "This is the default for most ISPs, so you should\n"
- "probably leave this option on."));
-
-
- staticgateway = new QRadioButton(box);
- staticgateway->setText(tr("Static gateway"));
- rb->insert(staticgateway, 1);
- QWhatsThis::add(staticgateway,
- tr("<p>Allows you to specify which computer you want\n"
- "to use as gateway (see <i>Default Gateway</i> above)"));
-
- QHBox *gateBox = new QHBox(box);
- gate_label = new QLabel(tr("Gateway IP address:"), gateBox);
- gatewayaddr = new IPLineEdit(gateBox);
-
- defaultroute = new QCheckBox(tr("Assign the default route to this gateway"),
- this);
- QWhatsThis::add(defaultroute,
- tr("If this option is enabled, all packets not\n"
- "going to the local net are routed through\n"
- "the PPP connection.\n"
- "\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") {
- defaultgateway->setChecked(true);
- hitGatewaySelect(0);
+ QVBoxLayout *topLayout = new QVBoxLayout(this);
+ topLayout->setSpacing( 2 );
+ topLayout->setMargin( 0 );
+
+ box = new QVGroupBox(tr("Configuration"), this);
+
+ rb = new QButtonGroup(this);
+ rb->hide();
+ connect(rb, SIGNAL(clicked(int)), SLOT(hitGatewaySelect(int)));
+
+ defaultgateway = new QRadioButton(box);
+ defaultgateway->setText(tr("Default gateway"));
+ rb->insert(defaultgateway, 0);
+ QWhatsThis::add(defaultgateway,
+ tr("This makes the PPP peer computer (the computer\n"
+ "you are connected to with your modem) to act as\n"
+ "a gateway. Your computer will send all packets not\n"
+ "going to a computer inside your local net to this\n"
+ "computer, which will route these packets.\n"
+ "\n"
+ "This is the default for most ISPs, so you should\n"
+ "probably leave this option on."));
+
+
+ staticgateway = new QRadioButton(box);
+ staticgateway->setText(tr("Static gateway"));
+ rb->insert(staticgateway, 1);
+ QWhatsThis::add(staticgateway,
+ tr("<p>Allows you to specify which computer you want\n"
+ "to use as gateway (see <i>Default Gateway</i> above)"));
+
+ QHBox *gateBox = new QHBox(box);
+ gate_label = new QLabel(tr("Gateway IP address:"), gateBox);
+ gatewayaddr = new IPLineEdit(gateBox);
+
+ defaultroute = new QCheckBox(tr("Assign the default route to this gateway"),
+ this);
+ QWhatsThis::add(defaultroute,
+ tr("If this option is enabled, all packets not\n"
+ "going to the local net are routed through\n"
+ "the PPP connection.\n"
+ "\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")
+ {
+ defaultgateway->setChecked(true);
+ hitGatewaySelect(0);
+ }
+ else
+ {
+ gatewayaddr->setText(_pppdata->gateway());
+ staticgateway->setChecked(true);
+ }
+ defaultroute->setChecked(_pppdata->defaultroute());
}
- else {
- gatewayaddr->setText(_pppdata->gateway());
- staticgateway->setChecked(true);
+ else
+ {
+ defaultgateway->setChecked(true);
+ hitGatewaySelect(0);
+ defaultroute->setChecked(true);
}
- defaultroute->setChecked(_pppdata->defaultroute());
- }
- else {
- defaultgateway->setChecked(true);
- hitGatewaySelect(0);
- defaultroute->setChecked(true);
- }
}
-void GatewayWidget::save() {
- _pppdata->setGateway(gatewayaddr->text());
- _pppdata->setDefaultroute(defaultroute->isChecked());
+void GatewayWidget::save()
+{
+ _pppdata->setGateway(gatewayaddr->text());
+ _pppdata->setDefaultroute(defaultroute->isChecked());
}
-void GatewayWidget::hitGatewaySelect( int i ) {
- if(i == 0) {
- gatewayaddr->setText("0.0.0.0");
- gatewayaddr->setEnabled(false);
- gate_label->setEnabled(false);
- }
- else {
- gatewayaddr->setEnabled(true);
- gatewayaddr->setText("");
- gate_label->setEnabled(true);
- }
+void GatewayWidget::hitGatewaySelect( int i )
+{
+ if(i == 0)
+ {
+ gatewayaddr->setText("0.0.0.0");
+ gatewayaddr->setEnabled(false);
+ gate_label->setEnabled(false);
+ }
+ else
+ {
+ gatewayaddr->setEnabled(true);
+ gatewayaddr->setText("");
+ gate_label->setEnabled(true);
+ }
}
ScriptWidget::ScriptWidget( PPPData *pd, QWidget *parent, bool isnewaccount, const char *name )
- : QWidget(parent, name),_pppdata(pd)
+ : QWidget(parent, name),_pppdata(pd)
{
- QVBoxLayout *tl = new QVBoxLayout(this, 0 );
- se = new ScriptEdit(this);
- connect(se, SIGNAL(returnPressed()), SLOT(addButton()));
- tl->addWidget(se);
-
- // insert equal-sized buttons
- QHBoxLayout *hl = new QHBoxLayout( this );
- tl->addLayout( hl );
- add = new QPushButton( tr("Add"), this );
- hl->addWidget( add );
- connect(add, SIGNAL(clicked()), SLOT(addButton()));
- insert = new QPushButton( tr("Insert"), this );
- hl->addWidget( insert );
- connect(insert, SIGNAL(clicked()), SLOT(insertButton()));
- remove = new QPushButton( tr("Remove"), this );
- hl->addWidget( remove );
- connect(remove, SIGNAL(clicked()), SLOT(removeButton()));
-
- QHBoxLayout *l12 = new QHBoxLayout(0);
- tl->addLayout(l12);
- stl = new QListBox(this);
-// stl->setVScrollBarMode( QScrollView::AlwaysOff );
- connect(stl, SIGNAL(highlighted(int)), SLOT(stlhighlighted(int)));
-// stl->setMinimumSize(QSize(70, 140));
-
- sl = new QListBox(this);
-// sl->setVScrollBarMode( QScrollView::AlwaysOff );
- connect(sl, SIGNAL(highlighted(int)), SLOT(slhighlighted(int)));
-// sl->setMinimumSize(QSize(150, 140));
-
- slb = new QScrollBar(this);
-// 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) {
- 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 )
+ QVBoxLayout *tl = new QVBoxLayout(this, 0 );
+ se = new ScriptEdit(this);
+ connect(se, SIGNAL(returnPressed()), SLOT(addButton()));
+ tl->addWidget(se);
+
+ // insert equal-sized buttons
+ QHBoxLayout *hl = new QHBoxLayout( this );
+ tl->addLayout( hl );
+ add = new QPushButton( tr("Add"), this );
+ hl->addWidget( add );
+ connect(add, SIGNAL(clicked()), SLOT(addButton()));
+ insert = new QPushButton( tr("Insert"), this );
+ hl->addWidget( insert );
+ connect(insert, SIGNAL(clicked()), SLOT(insertButton()));
+ remove = new QPushButton( tr("Remove"), this );
+ hl->addWidget( remove );
+ connect(remove, SIGNAL(clicked()), SLOT(removeButton()));
+
+ QHBoxLayout *l12 = new QHBoxLayout(0);
+ tl->addLayout(l12);
+ stl = new QListBox(this);
+ // stl->setVScrollBarMode( QScrollView::AlwaysOff );
+ connect(stl, SIGNAL(highlighted(int)), SLOT(stlhighlighted(int)));
+ // stl->setMinimumSize(QSize(70, 140));
+
+ sl = new QListBox(this);
+ // sl->setVScrollBarMode( QScrollView::AlwaysOff );
+ connect(sl, SIGNAL(highlighted(int)), SLOT(slhighlighted(int)));
+ // sl->setMinimumSize(QSize(150, 140));
+
+ slb = new QScrollBar(this);
+ // 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)
{
- stl->insertItem(*itcom);
- sl->insertItem(*itarg);
+ 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 )
+ {
+ stl->insertItem(*itcom);
+ sl->insertItem(*itarg);
+ }
}
- }
- insert->setEnabled(false);
- remove->setEnabled(false);
- adjustScrollBar();
- tl->activate();
+ insert->setEnabled(false);
+ remove->setEnabled(false);
+ adjustScrollBar();
+ tl->activate();
}
-bool ScriptWidget::check() {
- uint lstart = 0;
- uint lend = 0;
- uint errcnt = 0;
+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") {
- lstart++;
- }
- if (stl->text(i) == "LoopEnd") {
- lend++;
+ if(sl->count() > 0)
+ {
+ for( uint i=0; i <= sl->count()-1; i++)
+ {
+ if(stl->text(i) == "LoopStart")
+ {
+ lstart++;
+ }
+ if (stl->text(i) == "LoopEnd")
+ {
+ lend++;
+ }
+ if ( lend > lstart ) errcnt++;
}
- if ( lend > lstart ) errcnt++;
+ return ( (errcnt == 0 ) && (lstart == lend) );
}
- return ( (errcnt == 0 ) && (lstart == lend) );
- }
- return true;
+ return true;
}
-void ScriptWidget::save() {
- QStringList typelist, arglist;
- 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::save()
+{
+ QStringList typelist, arglist;
+ 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() {
- if((int)sl->count() <= sl->numItemsVisible())
- slb->setRange(0, 0);
- else
- slb->setRange(0, (sl->count() - sl->numItemsVisible())+1);
+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) {
- sl->setTopItem(i);
- stl->setTopItem(i);
+void ScriptWidget::scrolling(int i)
+{
+ sl->setTopItem(i);
+ stl->setTopItem(i);
}
-void ScriptWidget::slhighlighted(int i) {
- insert->setEnabled(true);
- remove->setEnabled(true);
- stl->setCurrentItem(i);
+void ScriptWidget::slhighlighted(int i)
+{
+ insert->setEnabled(true);
+ remove->setEnabled(true);
+ stl->setCurrentItem(i);
}
-void ScriptWidget::stlhighlighted(int i) {
- insert->setEnabled(true);
- remove->setEnabled(true);
- sl->setCurrentItem(i);
+void ScriptWidget::stlhighlighted(int i)
+{
+ insert->setEnabled(true);
+ remove->setEnabled(true);
+ sl->setCurrentItem(i);
}
-void ScriptWidget::addButton() {
- //don't allow more than the maximum script entries
- if(sl->count() == MAX_SCRIPT_ENTRIES-1)
- return;
+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;
+ stl->insertItem("Expect");
+ sl->insertItem(se->text());
+ break;
case ScriptEdit::Send:
- stl->insertItem("Send");
- sl->insertItem(se->text());
- break;
+ stl->insertItem("Send");
+ sl->insertItem(se->text());
+ break;
case ScriptEdit::SendNoEcho:
- stl->insertItem("SendNoEcho");
- sl->insertItem(se->text());
- break;
+ stl->insertItem("SendNoEcho");
+ sl->insertItem(se->text());
+ break;
case ScriptEdit::Pause:
- stl->insertItem("Pause");
- sl->insertItem(se->text());
- break;
+ stl->insertItem("Pause");
+ sl->insertItem(se->text());
+ break;
case ScriptEdit::Hangup:
- stl->insertItem("Hangup");
- sl->insertItem("");
- break;
+ stl->insertItem("Hangup");
+ sl->insertItem("");
+ break;
case ScriptEdit::Answer:
- stl->insertItem("Answer");
- sl->insertItem("");
- break;
+ stl->insertItem("Answer");
+ sl->insertItem("");
+ break;
case ScriptEdit::Timeout:
- stl->insertItem("Timeout");
- sl->insertItem(se->text());
- break;
+ stl->insertItem("Timeout");
+ sl->insertItem(se->text());
+ break;
case ScriptEdit::Password:
- stl->insertItem("Password");
- sl->insertItem(se->text());
- break;
+ stl->insertItem("Password");
+ sl->insertItem(se->text());
+ break;
case ScriptEdit::ID:
- stl->insertItem("ID");
- sl->insertItem(se->text());
- break;
+ stl->insertItem("ID");
+ sl->insertItem(se->text());
+ break;
case ScriptEdit::Prompt:
- stl->insertItem("Prompt");
- sl->insertItem(se->text());
- break;
+ stl->insertItem("Prompt");
+ sl->insertItem(se->text());
+ break;
case ScriptEdit::PWPrompt:
- stl->insertItem("PWPrompt");
- sl->insertItem(se->text());
- break;
+ stl->insertItem("PWPrompt");
+ sl->insertItem(se->text());
+ break;
case ScriptEdit::LoopStart:
- stl->insertItem("LoopStart");
- sl->insertItem(se->text());
- break;
+ stl->insertItem("LoopStart");
+ sl->insertItem(se->text());
+ break;
case ScriptEdit::LoopEnd:
- stl->insertItem("LoopEnd");
- sl->insertItem(se->text());
- break;
+ stl->insertItem("LoopEnd");
+ sl->insertItem(se->text());
+ break;
case ScriptEdit::Scan:
- stl->insertItem("Scan");
- sl->insertItem(se->text());
- break;
+ stl->insertItem("Scan");
+ sl->insertItem(se->text());
+ break;
case ScriptEdit::Save:
- stl->insertItem("Save");
- sl->insertItem(se->text());
- break;
+ stl->insertItem("Save");
+ sl->insertItem(se->text());
+ break;
default:
- break;
- }
+ break;
+ }
- //get the scrollbar adjusted, and scroll the list so we can see what
- //we're adding to
- adjustScrollBar();
- slb->setValue(slb->maxValue());
+ //get the scrollbar adjusted, and scroll the list so we can see what
+ //we're adding to
+ adjustScrollBar();
+ slb->setValue(slb->maxValue());
- //clear the text in the entry box
- se->setText("");
+ //clear the text in the entry box
+ se->setText("");
}
-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;
+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;
+ 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());
- break;
+ stl->insertItem("Send", stl->currentItem());
+ sl->insertItem(se->text(), sl->currentItem());
+ break;
case ScriptEdit::SendNoEcho:
- stl->insertItem("SendNoEcho", stl->currentItem());
- sl->insertItem(se->text(), sl->currentItem());
- break;
+ stl->insertItem("SendNoEcho", stl->currentItem());
+ sl->insertItem(se->text(), sl->currentItem());
+ break;
case ScriptEdit::Pause:
- stl->insertItem("Pause", stl->currentItem());
- sl->insertItem(se->text(), sl->currentItem());
- break;
+ stl->insertItem("Pause", stl->currentItem());
+ sl->insertItem(se->text(), sl->currentItem());
+ break;
case ScriptEdit::Hangup:
- stl->insertItem("Hangup", stl->currentItem());
- sl->insertItem("", sl->currentItem());
- break;
+ stl->insertItem("Hangup", stl->currentItem());
+ sl->insertItem("", sl->currentItem());
+ break;
case ScriptEdit::Answer:
- stl->insertItem("Answer", stl->currentItem());
- sl->insertItem("", sl->currentItem());
- break;
+ stl->insertItem("Answer", stl->currentItem());
+ sl->insertItem("", sl->currentItem());
+ break;
case ScriptEdit::Timeout:
- stl->insertItem("Timeout", stl->currentItem());
- sl->insertItem(se->text(), sl->currentItem());
- break;
+ stl->insertItem("Timeout", stl->currentItem());
+ sl->insertItem(se->text(), sl->currentItem());
+ break;
case ScriptEdit::Password:
- stl->insertItem("Password", stl->currentItem());
- sl->insertItem(se->text(), sl->currentItem());
- break;
+ stl->insertItem("Password", stl->currentItem());
+ sl->insertItem(se->text(), sl->currentItem());
+ break;
case ScriptEdit::ID:
- stl->insertItem("ID", stl->currentItem());
- sl->insertItem(se->text(), sl->currentItem());
- break;
+ stl->insertItem("ID", stl->currentItem());
+ sl->insertItem(se->text(), sl->currentItem());
+ break;
case ScriptEdit::Prompt:
- stl->insertItem("Prompt", stl->currentItem());
- sl->insertItem(se->text(), sl->currentItem());
- break;
+ stl->insertItem("Prompt", stl->currentItem());
+ sl->insertItem(se->text(), sl->currentItem());
+ break;
case ScriptEdit::PWPrompt:
- stl->insertItem("PWPrompt", stl->currentItem());
- sl->insertItem(se->text(), sl->currentItem());
- break;
+ stl->insertItem("PWPrompt", stl->currentItem());
+ sl->insertItem(se->text(), sl->currentItem());
+ break;
case ScriptEdit::LoopStart:
- stl->insertItem("LoopStart", stl->currentItem());
- sl->insertItem(se->text(), sl->currentItem());
- break;
+ stl->insertItem("LoopStart", stl->currentItem());
+ sl->insertItem(se->text(), sl->currentItem());
+ break;
case ScriptEdit::LoopEnd:
- stl->insertItem("LoopEnd", stl->currentItem());
- sl->insertItem(se->text(), sl->currentItem());
- break;
+ stl->insertItem("LoopEnd", stl->currentItem());
+ sl->insertItem(se->text(), sl->currentItem());
+ break;
case ScriptEdit::Scan:
- stl->insertItem("Scan", stl->currentItem());
- sl->insertItem(se->text(), sl->currentItem());
- break;
+ stl->insertItem("Scan", stl->currentItem());
+ sl->insertItem(se->text(), sl->currentItem());
+ break;
case ScriptEdit::Save:
- stl->insertItem("Save", stl->currentItem());
- sl->insertItem(se->text(), sl->currentItem());
- break;
+ stl->insertItem("Save", stl->currentItem());
+ sl->insertItem(se->text(), sl->currentItem());
+ break;
default:
- break;
- }
- adjustScrollBar();
- se->setText("");
+ break;
+ }
+ adjustScrollBar();
+ se->setText("");
}
-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);
- }
+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);
+ }
}
@@ -1089,45 +1164,47 @@ void ScriptWidget::removeButton() {
//
/////////////////////////////////////////////////////////////////////////////
PhoneNumberDialog::PhoneNumberDialog(QWidget *parent)
- : QDialog(parent,"PhoneNumberDialog",true)
+ : QDialog(parent,"PhoneNumberDialog",true)
{
setCaption( tr("Add Phone Number") );
- QVBoxLayout *layout = new QVBoxLayout( this );
- layout->setSpacing( 3 );
- layout->setMargin( 3 );
+ QVBoxLayout *layout = new QVBoxLayout( this );
+ layout->setSpacing( 3 );
+ layout->setMargin( 3 );
-// QHBox *hbox = new QHBox(this);
-// setMainWidget(hbox);
+ // QHBox *hbox = new QHBox(this);
+ // setMainWidget(hbox);
-// hbox->setSpacing( 2 );//KDialog::spacingHint());
+ // hbox->setSpacing( 2 );//KDialog::spacingHint());
- QLabel *label = new QLabel(this, tr("Enter a phone number:"));
- layout->addWidget( label );
+ QLabel *label = new QLabel(this, tr("Enter a phone number:"));
+ layout->addWidget( label );
- le = new QLineEdit(this, "lineEdit");
- layout->addWidget( le );
+ le = new QLineEdit(this, "lineEdit");
+ layout->addWidget( le );
- connect(le, SIGNAL(textChanged(const QString &)),
- this, SLOT(textChanged(const QString &)));
+ connect(le, SIGNAL(textChanged(const QString &)),
+ this, SLOT(textChanged(const QString &)));
- le->setFocus();
- textChanged("");
+ le->setFocus();
+ textChanged("");
}
-QString PhoneNumberDialog::phoneNumber() {
- QString s = le->text();
+QString PhoneNumberDialog::phoneNumber()
+{
+ QString s = le->text();
- return s;
+ return s;
}
-void PhoneNumberDialog::textChanged(const QString &s) {
-// enableButtonOK(s.length() > 0);
+void PhoneNumberDialog::textChanged(const QString &s)
+{
+ // enableButtonOK(s.length() > 0);
}
diff --git a/noncore/settings/sysinfo/modulesinfo.cpp b/noncore/settings/sysinfo/modulesinfo.cpp
index 566b179..9cb8ad2 100644
--- a/noncore/settings/sysinfo/modulesinfo.cpp
+++ b/noncore/settings/sysinfo/modulesinfo.cpp
@@ -19,19 +19,21 @@
**
**********************************************************************/
+#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 )
+ : QWidget( parent, name, fl )
{
QGridLayout *layout = new QGridLayout( this );
layout->setSpacing( 4 );
@@ -47,14 +49,14 @@ ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl )
ModulesView->setAllColumnsShowFocus( TRUE );
layout->addMultiCellWidget( ModulesView, 0, 0, 0, 1 );
QWhatsThis::add( ModulesView, tr( "This is a list of all the kernel modules currently loaded on this handheld device.\n\nClick and hold on a module to see additional information about the module, or to unload it." ) );
-
- // Test if we have /sbin/modinfo, and if so, allow module detail window
- if ( QFile::exists( "/sbin/modinfo" ) )
- {
- QPEApplication::setStylusOperation( ModulesView->viewport(), QPEApplication::RightOnHold );
- connect( ModulesView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ),
- this, SLOT( viewModules( QListViewItem * ) ) );
- }
+
+ // Test if we have /sbin/modinfo, and if so, allow module detail window
+ if ( QFile::exists( "/sbin/modinfo" ) )
+ {
+ QPEApplication::setStylusOperation( ModulesView->viewport(), QPEApplication::RightOnHold );
+ connect( ModulesView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ),
+ this, SLOT( viewModules( QListViewItem * ) ) );
+ }
CommandCB = new QComboBox( FALSE, this );
CommandCB->insertItem( "modprobe -r" );
@@ -74,16 +76,15 @@ ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl )
QTimer *t = new QTimer( this );
connect( t, SIGNAL( timeout() ), this, SLOT( updateData() ) );
t->start( 5000 );
-
+
updateData();
-
- ModulesDtl = new Detail();
+
+ ModulesDtl = new Detail();
QWhatsThis::add( ModulesDtl->detailView, tr( "This area shows detailed information about this module." ) );
}
ModulesInfo::~ModulesInfo()
-{
-}
+{}
void ModulesInfo::updateData()
{
@@ -97,7 +98,7 @@ void ModulesInfo::updateData()
{
selectedmod = curritem->text( 0 );
}
-
+
ModulesView->clear();
FILE *procfile = fopen( ( QString ) ( "/proc/modules"), "r");
@@ -106,7 +107,8 @@ void ModulesInfo::updateData()
{
QListViewItem *newitem;
QListViewItem *selecteditem = 0x0;
- while ( true ) {
+ while ( true )
+ {
modname[0] = '\0';
usage[0] = '\0';
int success = fscanf( procfile, "%s%d%d%[^\n]", modname, &modsize, &usecount, usage );
@@ -133,22 +135,22 @@ void ModulesInfo::updateData()
void ModulesInfo::slotSendClicked()
{
- if ( !ModulesView->currentItem() )
- {
- return;
- }
-
- QString capstr = tr( "You really want to execute %1 for this module?" ).arg( CommandCB->currentText() );
-
- QString modname = ModulesView->currentItem()->text( 0 );
-
+ if ( !ModulesView->currentItem() )
+ {
+ return;
+ }
+
+ QString capstr = tr( "You really want to execute %1 for this module?" ).arg( CommandCB->currentText() );
+
+ QString modname = ModulesView->currentItem()->text( 0 );
+
if ( QMessageBox::warning( this, modname, capstr,
- QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape ) == QMessageBox::Yes )
+ QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape ) == QMessageBox::Yes )
{
- QString command = "/sbin/";
- command.append( CommandCB->currentText() );
- command.append( " " );
- command.append( modname );
+ QString command = "/sbin/";
+ command.append( CommandCB->currentText() );
+ command.append( " " );
+ command.append( modname );
FILE* stream = popen( command, "r" );
if ( stream )
@@ -159,30 +161,30 @@ void ModulesInfo::slotSendClicked()
void ModulesInfo::viewModules( QListViewItem *modules )
{
- QString modname = modules->text( 0 );
- QString capstr = "Module: ";
- capstr.append( modname );
+ QString modname = modules->text( 0 );
+ QString capstr = "Module: ";
+ capstr.append( modname );
ModulesDtl->setCaption( capstr );
QString command = "/sbin/modinfo ";
- command.append( modname );
+ command.append( modname );
FILE* modinfo = popen( command, "r" );
-
+
if ( modinfo )
{
char line[200];
ModulesDtl->detailView->setText( " Details:\n------------\n" );
-
+
while( true )
- {
+ {
int success = fscanf( modinfo, "%[^\n]\n", line );
if ( success == EOF )
- break;
+ 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
@@ -17,22 +17,25 @@
**
**********************************************************************/
+#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 )
+ : QWidget( parent, name, fl )
{
QGridLayout *layout = new QGridLayout( this );
layout->setSpacing( 4 );
@@ -49,10 +52,10 @@ ProcessInfo::ProcessInfo( QWidget* parent, const char* name, WFlags fl )
ProcessView->setAllColumnsShowFocus( TRUE );
QPEApplication::setStylusOperation( ProcessView->viewport(), QPEApplication::RightOnHold );
connect( ProcessView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ),
- this, SLOT( viewProcess( QListViewItem * ) ) );
+ this, SLOT( viewProcess( QListViewItem * ) ) );
layout->addMultiCellWidget( ProcessView, 0, 0, 0, 1 );
QWhatsThis::add( ProcessView, tr( "This is a list of all the processes on this handheld device.\n\nClick and hold on a process to see additional information about the process, or to send a signal to it." ) );
-
+
SignalCB = new QComboBox( FALSE, this, "SignalCB" );
SignalCB->insertItem( " 1: SIGHUP" );
SignalCB->insertItem( " 2: SIGINT" );
@@ -86,15 +89,14 @@ ProcessInfo::ProcessInfo( QWidget* parent, const char* name, WFlags fl )
}
ProcessInfo::~ProcessInfo()
-{
-}
+{}
void ProcessInfo::updateData()
{
int pid, ppid, pgrp, session, tty, tpgid, utime, stime, cutime, cstime, counter, priority, starttime,
- signal, blocked, sigignore, sigcatch;
+ signal, blocked, sigignore, sigcatch;
uint flags, minflt, cminflt, majflt, cmajflt, timeout, itrealvalue, vsize, rss, rlim, startcode,
- endcode, startstack, kstkesp, kstkeip, wchan;
+ endcode, startstack, kstkesp, kstkeip, wchan;
char state;
char comm[64];
@@ -104,7 +106,7 @@ void ProcessInfo::updateData()
{
selectedpid = curritem->text( 0 );
}
-
+
ProcessView->clear();
QListViewItem *newitem;
@@ -126,11 +128,11 @@ void ProcessInfo::updateData()
if ( procfile )
{
fscanf( procfile,
- "%d %s %c %d %d %d %d %d %u %u %u %u %u %d %d %d %d %d %d %u %u %d %u %u %u %u %u %u %u %u %d %d %d %d %u",
- &pid, comm, &state, &ppid, &pgrp, &session,&tty, &tpgid, &flags, &minflt, &cminflt,
- &majflt, &cmajflt, &utime, &stime, &cutime, &cstime, &counter, &priority, &timeout,
- &itrealvalue, &starttime, &vsize, &rss, &rlim, &startcode, &endcode, &startstack,
- &kstkesp, &kstkeip, &signal, &blocked, &sigignore, &sigcatch, &wchan );
+ "%d %s %c %d %d %d %d %d %u %u %u %u %u %d %d %d %d %d %d %u %u %d %u %u %u %u %u %u %u %u %d %d %d %d %u",
+ &pid, comm, &state, &ppid, &pgrp, &session,&tty, &tpgid, &flags, &minflt, &cminflt,
+ &majflt, &cmajflt, &utime, &stime, &cutime, &cstime, &counter, &priority, &timeout,
+ &itrealvalue, &starttime, &vsize, &rss, &rlim, &startcode, &endcode, &startstack,
+ &kstkesp, &kstkeip, &signal, &blocked, &sigignore, &sigcatch, &wchan );
processnum = processnum.rightJustify( 5, ' ' );
QString processcmd = QString( comm ).replace( QRegExp( "[()]" ), "" );
QString processstatus = QChar(state);
@@ -155,26 +157,26 @@ void ProcessInfo::updateData()
void ProcessInfo::slotSendClicked()
{
- QListViewItem *currprocess = ProcessView->currentItem();
- if ( !currprocess )
- {
- return;
- }
-
- QString capstr = tr( "Really want to send %1\nto this process?" ).arg( SignalCB->currentText() );
-
-
- if ( QMessageBox::warning( this, currprocess->text( 1 ), capstr,
- QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape ) == QMessageBox::Yes )
- {
- currprocess = ProcessView->currentItem();
- if ( currprocess )
- {
- QString sigstr = SignalCB->currentText();
- sigstr.truncate(2);
- int sigid = sigstr.toUInt();
- kill( currprocess->text( 0 ).stripWhiteSpace().toUInt(), sigid );
- }
+ QListViewItem *currprocess = ProcessView->currentItem();
+ if ( !currprocess )
+ {
+ return;
+ }
+
+ QString capstr = tr( "Really want to send %1\nto this process?" ).arg( SignalCB->currentText() );
+
+
+ if ( QMessageBox::warning( this, currprocess->text( 1 ), capstr,
+ QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape ) == QMessageBox::Yes )
+ {
+ currprocess = ProcessView->currentItem();
+ if ( currprocess )
+ {
+ QString sigstr = SignalCB->currentText();
+ sigstr.truncate(2);
+ int sigid = sigstr.toUInt();
+ kill( currprocess->text( 0 ).stripWhiteSpace().toUInt(), sigid );
+ }
}
}
@@ -196,5 +198,5 @@ void ProcessInfo::viewProcess( QListViewItem *process )
}
fclose( statfile );
}
- ProcessDtl->showMaximized();
+ QPEApplication::showWidget( ProcessDtl );
}
diff --git a/noncore/settings/usermanager/userdialog.cpp b/noncore/settings/usermanager/userdialog.cpp
index d87a005..08de352 100644
--- a/noncore/settings/usermanager/userdialog.cpp
+++ b/noncore/settings/usermanager/userdialog.cpp
@@ -8,20 +8,25 @@
***************************************************************************/
#include "userdialog.h"
+#include "passwd.h"
+
+/* OPIE */
+#include <opie/odevice.h>
+#include <qpe/qpeapplication.h>
+/* QT */
#include <qlayout.h>
#include <qlabel.h>
#include <qmessagebox.h>
#include <qfile.h>
+/* STD */
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <signal.h>
-#include "passwd.h"
-#include <opie/odevice.h>
using namespace Opie;
@@ -29,160 +34,168 @@ 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) {
- 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) {
- accounts->splitGroupEntry(*it);
- if(accounts->gr_name.find(QRegExp("^#"),0)) { // Skip commented lines.
- new QCheckListItem(groupsListView,accounts->gr_name,QCheckListItem::CheckBox);
- groupComboBox->insertItem(accounts->gr_name);
- }
- }
- showMaximized();
+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)
+ {
+ accounts->splitGroupEntry(*it);
+ if(accounts->gr_name.find(QRegExp("^#"),0))
+ { // Skip commented lines.
+ new QCheckListItem(groupsListView,accounts->gr_name,QCheckListItem::CheckBox);
+ groupComboBox->insertItem(accounts->gr_name);
+ }
+ }
+ QPEApplication::showDialog( this );
}
/**
* Empty destructor.
*
*/
-UserDialog::~UserDialog() {
-}
+UserDialog::~UserDialog()
+{}
/**
* Creates the first tab, all userinfo is here.
*
*/
-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);
- picturePushButton->setMaximumSize(48,48);
- picturePushButton->setPixmap(Resource::loadPixmap("usermanager/usericon")); // Load default usericon.
- connect(picturePushButton,SIGNAL(clicked()),this,SLOT(clickedPicture())); // Clicking the picture should invoke pictureselector.
-
- // Login
- QLabel *loginLabel=new QLabel(tabpage,"Login: ");
- loginLabel->setText("Login: ");
- loginLineEdit=new QLineEdit(tabpage,"Login: ");
-
- // UID
- QLabel *uidLabel=new QLabel(tabpage,"uid: ");
- uidLabel->setText("UserID: ");
- uidLineEdit=new QLineEdit(tabpage,"uid: ");
- uidLineEdit->setEnabled(false);
-
- // Username (gecos)
- QLabel *gecosLabel=new QLabel(tabpage,"gecos");
- gecosLabel->setText("Username: ");
- gecosLineEdit=new QLineEdit(tabpage,"gecos");
-
- // Password
- QLabel *passwordLabel=new QLabel(tabpage,"password");
- passwordLabel->setText("Password: ");
- passwordLineEdit=new QLineEdit(tabpage,"password");
- passwordLineEdit->setEchoMode(QLineEdit::Password);
-
- // Shell
- QLabel *shellLabel=new QLabel(tabpage,"shell");
- shellLabel->setText("Shell: ");
- shellComboBox=new QComboBox(tabpage,"shell");
- shellComboBox->setEditable(true);
- shellComboBox->insertItem("/bin/sh");
- 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) {
- // Copy /etc/skel
- skelLabel=new QLabel(tabpage,"skel");
- skelLabel->setText("Copy /etc/skel: ");
- skelCheckBox=new QCheckBox(tabpage);
- skelCheckBox->setChecked(true);
- }
-
- // Widget layout
- QHBoxLayout *hlayout=new QHBoxLayout(-1,"hlayout");
- layout->addWidget(picturePushButton);
- layout->addSpacing(5);
- layout->addLayout(hlayout);
- QVBoxLayout *vlayout1=new QVBoxLayout(-1,"vlayout1");
- QVBoxLayout *vlayout2=new QVBoxLayout(-1,"vlayout2");
- // First column, labels
- vlayout1->addWidget(loginLabel);
- vlayout1->addSpacing(5);
- vlayout1->addWidget(uidLabel);
- 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) {
- 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) {
- vlayout2->addSpacing(5);
- vlayout2->addWidget(skelCheckBox);
- }
- hlayout->addLayout(vlayout1);
- hlayout->addLayout(vlayout2);
-
- myTabWidget->addTab(tabpage,"User Info");
+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);
+ picturePushButton->setMaximumSize(48,48);
+ picturePushButton->setPixmap(Resource::loadPixmap("usermanager/usericon")); // Load default usericon.
+ connect(picturePushButton,SIGNAL(clicked()),this,SLOT(clickedPicture())); // Clicking the picture should invoke pictureselector.
+
+ // Login
+ QLabel *loginLabel=new QLabel(tabpage,"Login: ");
+ loginLabel->setText("Login: ");
+ loginLineEdit=new QLineEdit(tabpage,"Login: ");
+
+ // UID
+ QLabel *uidLabel=new QLabel(tabpage,"uid: ");
+ uidLabel->setText("UserID: ");
+ uidLineEdit=new QLineEdit(tabpage,"uid: ");
+ uidLineEdit->setEnabled(false);
+
+ // Username (gecos)
+ QLabel *gecosLabel=new QLabel(tabpage,"gecos");
+ gecosLabel->setText("Username: ");
+ gecosLineEdit=new QLineEdit(tabpage,"gecos");
+
+ // Password
+ QLabel *passwordLabel=new QLabel(tabpage,"password");
+ passwordLabel->setText("Password: ");
+ passwordLineEdit=new QLineEdit(tabpage,"password");
+ passwordLineEdit->setEchoMode(QLineEdit::Password);
+
+ // Shell
+ QLabel *shellLabel=new QLabel(tabpage,"shell");
+ shellLabel->setText("Shell: ");
+ shellComboBox=new QComboBox(tabpage,"shell");
+ shellComboBox->setEditable(true);
+ shellComboBox->insertItem("/bin/sh");
+ 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)
+ {
+ // Copy /etc/skel
+ skelLabel=new QLabel(tabpage,"skel");
+ skelLabel->setText("Copy /etc/skel: ");
+ skelCheckBox=new QCheckBox(tabpage);
+ skelCheckBox->setChecked(true);
+ }
+
+ // Widget layout
+ QHBoxLayout *hlayout=new QHBoxLayout(-1,"hlayout");
+ layout->addWidget(picturePushButton);
+ layout->addSpacing(5);
+ layout->addLayout(hlayout);
+ QVBoxLayout *vlayout1=new QVBoxLayout(-1,"vlayout1");
+ QVBoxLayout *vlayout2=new QVBoxLayout(-1,"vlayout2");
+ // First column, labels
+ vlayout1->addWidget(loginLabel);
+ vlayout1->addSpacing(5);
+ vlayout1->addWidget(uidLabel);
+ 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)
+ {
+ 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)
+ {
+ 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() {
- 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);
- groupsListView->setMultiSelection(false);
- groupsListView->setAllColumnsShowFocus(false);
-
- layout->addSpacing(5);
- // Grouplist
- layout->addWidget(groupsListView);
-
- myTabWidget->addTab(tabpage,"User Groups");
+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);
+ groupsListView->setMultiSelection(false);
+ groupsListView->setAllColumnsShowFocus(false);
+
+ layout->addSpacing(5);
+ // Grouplist
+ layout->addWidget(groupsListView);
+
+ myTabWidget->addTab(tabpage,"User Groups");
}
/**
@@ -195,81 +208,90 @@ void UserDialog::setupTab2() {
* @return <code>true</code> if the user was successfully added, otherwise <code>false</code>.
*
*/
-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) {
- QListViewItemIterator iter( adduserDialog->groupsListView );
- 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)) {
- 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()))) {
- 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 ) {
- 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())) {
- QDir d;
- 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()) {
- 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);
-
- command_chown.sprintf("chown -R %d:%d %s",accounts->pw_uid,accounts->pw_gid,accounts->pw_dir.latin1());
- system(command_chown);
- }
-
- return true;
+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)
+ {
+ QListViewItemIterator iter( adduserDialog->groupsListView );
+ 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))
+ {
+ 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())))
+ {
+ 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 )
+ {
+ 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()))
+ {
+ QDir d;
+ 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())
+ {
+ 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);
+
+ command_chown.sprintf("chown -R %d:%d %s",accounts->pw_uid,accounts->pw_gid,accounts->pw_dir.latin1());
+ system(command_chown);
+ }
+
+ return true;
}
/**
@@ -280,16 +302,21 @@ bool UserDialog::addUser(int uid, int gid) {
* @return <code>true</code> if the user was successfully deleted, otherwise <code>false</code>.
*
*/
-bool UserDialog::delUser(const char *username) {
- if((accounts->findUser(username))) { // Does that user exist?
- if(!(accounts->delUser(username))) { // Delete the user.
- QMessageBox::information(0,"Ooops!","Something went wrong\nUnable to delete user: "+QString(username)+".");
- }
- } else {
- QMessageBox::information(0,"Invalid Username","That username ("+QString(username)+")does not exist.");
- return false;
- }
- return true;
+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
+ {
+ QMessageBox::information(0,"Invalid Username","That username ("+QString(username)+")does not exist.");
+ return false;
+ }
+ return true;
}
/**
@@ -301,138 +328,162 @@ bool UserDialog::delUser(const char *username) {
* @return <code>true</code> if the user was successfully deleted, otherwise <code>false</code>.
*
*/
-bool UserDialog::editUser(const char *username) {
- 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.
- 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") {
- 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)) {
- edituserDialog->groupComboBox->setCurrentItem(i);
- break;
- }
- }
- 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.
- qWarning(*it);
- QListViewItemIterator lvit( edituserDialog->groupsListView ); // Compare to all groups.
- 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.
- qWarning(*it);
- QListViewItemIterator lvit( edituserDialog->groupsListView ); // Compare to all groups.
- 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.
- 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) {
- 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 ) {
- 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())) {
- QDir d;
- 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;
+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.
+ 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")
+ {
+ 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))
+ {
+ edituserDialog->groupComboBox->setCurrentItem(i);
+ break;
+ }
+ }
+ 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.
+ qWarning(*it);
+ QListViewItemIterator lvit( edituserDialog->groupsListView ); // Compare to all groups.
+ 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.
+ qWarning(*it);
+ QListViewItemIterator lvit( edituserDialog->groupsListView ); // Compare to all groups.
+ 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.
+ 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)
+ {
+ 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 )
+ {
+ 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()))
+ {
+ QDir d;
+ 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() {
- // Add checking... valid username? username taken?
- if(loginLineEdit->text().isEmpty()) {
- QMessageBox::information(0,"Empty Login","Please enter a login.");
- return;
- }
- QDialog::accept();
+void UserDialog::accept()
+{
+ // Add checking... valid username? username taken?
+ 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() {
- QString filename=OFileDialog::getOpenFileName(OFileSelector::EXTENDED, QString::null);
- if(!(filename.isEmpty())) {
- userImage.reset();
- if(!(userImage.load(filename))) {
- QMessageBox::information(0,"Sorry!","That icon could not be loaded.\nLoading failed on: "+filename);
- } else {
-// userImage=userImage.smoothScale(48,48);
- QPixmap *picture;
- picture=(QPixmap *)picturePushButton->pixmap();
- picture->convertFromImage(userImage,0);
- picturePushButton->update();
- }
- }
+void UserDialog::clickedPicture()
+{
+ QString filename=OFileDialog::getOpenFileName(OFileSelector::EXTENDED, QString::null);
+ if(!(filename.isEmpty()))
+ {
+ userImage.reset();
+ if(!(userImage.load(filename)))
+ {
+ QMessageBox::information(0,"Sorry!","That icon could not be loaded.\nLoading failed on: "+filename);
+ }
+ else
+ {
+ // userImage=userImage.smoothScale(48,48);
+ QPixmap *picture;
+ picture=(QPixmap *)picturePushButton->pixmap();
+ picture->convertFromImage(userImage,0);
+ picturePushButton->update();
+ }
+ }
}