summaryrefslogtreecommitdiff
path: root/noncore/settings
authoralwin <alwin>2004-03-02 12:21:11 (UTC)
committer alwin <alwin>2004-03-02 12:21:11 (UTC)
commitb6b1c97559c0ed9f2e33632272426bf98f289232 (patch) (side-by-side diff)
treed3a9987704770cdf5eb14e1136f6e3ecb2f36a04 /noncore/settings
parent0d59c780513da78033f4d9040475dee9db0256d4 (diff)
downloadopie-b6b1c97559c0ed9f2e33632272426bf98f289232.zip
opie-b6b1c97559c0ed9f2e33632272426bf98f289232.tar.gz
opie-b6b1c97559c0ed9f2e33632272426bf98f289232.tar.bz2
applied the patch generated by the optimize_connect script from
TT.
Diffstat (limited to 'noncore/settings') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/appearance2/appearance.cpp24
-rw-r--r--noncore/settings/appearance2/sample.cpp4
-rw-r--r--noncore/settings/aqpkg/inputdlg.cpp4
-rw-r--r--noncore/settings/aqpkg/installdlgimpl.cpp8
-rw-r--r--noncore/settings/aqpkg/ipkg.cpp10
-rw-r--r--noncore/settings/aqpkg/mainwin.cpp26
-rw-r--r--noncore/settings/aqpkg/settingsimpl.cpp4
-rw-r--r--noncore/settings/backup/backuprestore.cpp4
-rw-r--r--noncore/settings/netsystemtime/mainwindow.cpp14
-rw-r--r--noncore/settings/netsystemtime/settingstabwidget.cpp4
-rw-r--r--noncore/settings/netsystemtime/timetabwidget.cpp2
-rw-r--r--noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp4
-rw-r--r--noncore/settings/networksettings/mainwindowimp.cpp14
-rw-r--r--noncore/settings/networksettings/ppp/edit.cpp8
-rw-r--r--noncore/settings/networksettings/ppp/general.cpp4
-rw-r--r--noncore/settings/networksettings/ppp/kpppwidget.cpp12
-rw-r--r--noncore/settings/networksettings/ppp/pppdargs.cpp4
-rw-r--r--noncore/settings/networksettings/wlan/wlanimp2.cpp2
-rw-r--r--noncore/settings/packagemanager/filterdlg.cpp2
-rw-r--r--noncore/settings/packagemanager/mainwindow.cpp8
-rw-r--r--noncore/settings/packagemanager/oipkg.cpp16
-rw-r--r--noncore/settings/sound/soundsettings.cpp20
-rw-r--r--noncore/settings/sysinfo/benchmarkinfo.cpp2
-rw-r--r--noncore/settings/sysinfo/modulesinfo.cpp4
-rw-r--r--noncore/settings/sysinfo/processinfo.cpp4
-rw-r--r--noncore/settings/tabmanager/tabmanager.cpp4
-rw-r--r--noncore/settings/usermanager/usermanager.cpp2
27 files changed, 107 insertions, 107 deletions
diff --git a/noncore/settings/appearance2/appearance.cpp b/noncore/settings/appearance2/appearance.cpp
index b39203b..8ae87fe 100644
--- a/noncore/settings/appearance2/appearance.cpp
+++ b/noncore/settings/appearance2/appearance.cpp
@@ -28,559 +28,559 @@
*/
#include "appearance.h"
#include "editScheme.h"
#include "stylelistitem.h"
#include "decolistitem.h"
#include "colorlistitem.h"
#include "exceptlistitem.h"
#include "sample.h"
/* OPIE */
#include <opie2/odevice.h>
#include <opie2/ofiledialog.h>
#include <opie2/otabwidget.h>
#include <qpe/config.h>
#include <qpe/global.h>
#include <qpe/qpeapplication.h>
#include <qpe/qpemessagebox.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/qpestyle.h>
#include <qpe/lightstyle.h>
#include <qpe/styleinterface.h>
/* QT */
#include <qbuttongroup.h>
#include <qcheckbox.h>
#include <qcombobox.h>
#include <qdialog.h>
#include <qdir.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qlineedit.h>
#include <qlistbox.h>
#include <qmessagebox.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#if QT_VERSION >= 300
#include <qstylefactory.h>
#endif
#include <qtoolbutton.h>
#include <qwindowsstyle.h>
#include <qlistview.h>
#include <qheader.h>
#include <qvbox.h>
#include <qwhatsthis.h>
using namespace Opie;
class DefaultWindowDecoration : public WindowDecorationInterface
{
public:
DefaultWindowDecoration() : ref(0) {}
QString name() const
{
return "Default";
}
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;
}
Q_REFCOUNT
private:
ulong ref;
};
QWidget *Appearance::createStyleTab ( QWidget *parent, Config &cfg )
{
QWidget* tab = new QWidget( parent, "StyleTab" );
QVBoxLayout* vertLayout = new QVBoxLayout( tab, 3, 3 );
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." ) );
m_style_settings = new QPushButton ( tr( "Settings..." ), tab );
- connect ( m_style_settings, SIGNAL( clicked ( )), this, SLOT( styleSettingsClicked ( )));
+ 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." ) );
QString s = cfg. readEntry ( "Style", "Light" );
#if QT_VERSION >= 300
m_style_list->insertStringList(QStyleFactory::styles());
#else
m_style_list-> insertItem ( new StyleListItem ( "Windows", new QWindowsStyle ( )));
m_style_list-> insertItem ( new StyleListItem ( "Light", new LightStyle ( )));
m_style_list-> insertItem ( new StyleListItem ( "QPE", new QPEStyle ( )));
#endif
{
QString path = QPEApplication::qpeDir ( );
path.append( "/plugins/styles/" );
QStringList sl = QDir ( path, "lib*.so" ). entryList ( );
for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it )
{
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 ) ) );
+ connect( m_style_list, SIGNAL( highlighted(int) ), this, SLOT( styleClicked(int) ) );
return tab;
}
QWidget *Appearance::createDecoTab ( QWidget *parent, Config &cfg )
{
QWidget* tab = new QWidget( parent, "DecoTab" );
QVBoxLayout* vertLayout = new QVBoxLayout( tab, 3, 3 );
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." ) );
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;
}
}
m_original_deco = m_deco_list-> currentItem ( );
if ( m_deco_list-> currentItem ( ) < 0 )
m_deco_list-> setCurrentItem ( 0 );
decoClicked ( m_original_deco );
- connect( m_deco_list, SIGNAL( highlighted( int ) ), this, SLOT( decoClicked( int ) ) );
+ connect( m_deco_list, SIGNAL( highlighted(int) ), this, SLOT( decoClicked(int) ) );
return tab;
}
QWidget *Appearance::createFontTab ( QWidget *parent, Config &cfg )
{
QString familyStr = cfg. readEntry ( "FontFamily", "Helvetica" );
QString styleStr = cfg. readEntry ( "FontStyle", "Regular" );
int size = cfg. readNumEntry ( "FontSize", 10 );
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." ) );
- connect( m_fontselect, SIGNAL( fontSelected ( const QFont & )),
- this, SLOT( fontClicked ( const QFont & )));
+ connect( m_fontselect, SIGNAL( fontSelected(const QFont&)),
+ this, SLOT( fontClicked(const QFont&)));
return m_fontselect;
}
QWidget *Appearance::createColorTab ( QWidget *parent, Config &cfg )
{
QWidget *tab = new QWidget( parent, "ColorTab" );
QGridLayout *gridLayout = new QGridLayout( tab, 0, 0, 3, 3 );
gridLayout->setRowStretch ( 3, 10 );
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 ) ) );
+ 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." ) );
m_color_list-> insertItem ( new ColorListItem ( tr( "Current scheme" ), cfg ));
QString path = QPEApplication::qpeDir ( );
path.append( "/etc/colors/" );
QStringList sl = QDir ( path ). entryList ( "*.scheme" );
for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it )
{
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-> setCurrentItem ( 0 );
QPushButton* tempButton = new QPushButton( tab, "editSchemeButton" );
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." ) );
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." ) );
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." ) );
return tab;
}
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 )));
+ 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 ( )));
+ 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 ( )));
+ 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 ( )));
+ 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 ( )));
+ 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" );
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" ) );
QButtonGroup* btngrp = new QButtonGroup( tab, "buttongroup" );
btngrp-> hide ( );
btngrp-> setExclusive ( true );
m_tabstyle_list = new QComboBox ( false, tab, "tabstyle" );
m_tabstyle_list-> insertItem ( tr( "Tabs" ));
m_tabstyle_list-> insertItem ( tr( "Tabs w/icons" ));
m_tabstyle_list-> insertItem ( tr( "Drop down list" ));
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" ) );
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." ) );
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." ) );
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;
}
Appearance::Appearance( QWidget* parent, const char* name, WFlags )
: QDialog ( parent, name, true, WStyle_ContextHelp )
{
setCaption( tr( "Appearance Settings" ) );
Config config( "qpe" );
config.setGroup( "Appearance" );
QVBoxLayout *top = new QVBoxLayout ( this, 3, 3 );
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." ) );
OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom );
QWidget *styletab;
m_color_list = 0;
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" ) );
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 ( );
}
void Appearance::accept ( )
{
bool newtabpos = m_tabstyle_top-> isChecked ( );
int newtabstyle = m_tabstyle_list-> currentItem ( );
Config config ( "qpe" );
config. setGroup ( "Appearance" );
if ( m_style_changed )
{
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 )
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 ( m_font_changed )
{
config. writeEntry ( "FontFamily", m_fontselect-> fontFamily ( ));
config. writeEntry ( "FontStyle", m_fontselect-> fontStyle ( ));
config. writeEntry ( "FontSize", m_fontselect-> fontSize ( ));
}
if ( m_color_changed )
{
ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
if ( item )
item-> save ( config );
}
ODirection rot;
if (m_rotdir_ccw-> isChecked ( ))
{
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 ( );
diff --git a/noncore/settings/appearance2/sample.cpp b/noncore/settings/appearance2/sample.cpp
index b3a9d48..f6c4dca 100644
--- a/noncore/settings/appearance2/sample.cpp
+++ b/noncore/settings/appearance2/sample.cpp
@@ -1,220 +1,220 @@
/*
                This file is part of the OPIE Project
=. Copyright (c) 2002 Trolltech AS <info@trolltech.com>
             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
           .>+-=
 _;:,     .>    :=|. This file is free software; you can
.> <`_,   >  .   <= redistribute it and/or modify it under
:`=1 )Y*s>-.--   : the terms of the GNU General Public
.="- .-=="i,     .._ License as published by the Free Software
 - .   .-<_>     .<> Foundation; either version 2 of the License,
     ._= =}       : or (at your option) any later version.
    .%`+i>       _;_.
    .i_,=:_.      -<s. This file is distributed in the hope that
     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
    : ..    .:,     . . . without even the implied warranty of
    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
..}^=.=       =       ; Public License for more details.
++=   -.     .`     .:
 :     =  ...= . :.=- You should have received a copy of the GNU
 -.   .:....=;==+<; General Public License along with this file;
  -_. . .   )=.  = see the file COPYING. If not, write to the
    --        :-=` Free Software Foundation, Inc.,
59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <qvbox.h>
#include <qpopupmenu.h>
#include <qpainter.h>
#include <qmenubar.h>
#include <qcheckbox.h>
#include <qpushbutton.h>
#include <qscrollbar.h>
#include <qlayout.h>
#include <qwhatsthis.h>
#include <qpixmapcache.h>
#include <qtimer.h>
#include <qobjectlist.h>
#include <qcommonstyle.h>
#include "sample.h"
class SampleText : public QWidget
{
public:
SampleText( const QString &t, bool h, QWidget *parent )
: QWidget( parent ), hl(h), text(t)
{
if ( hl )
setBackgroundMode( PaletteHighlight );
else
setBackgroundMode( PaletteBase );
}
QSize sizeHint() const
{
QFontMetrics fm(font());
return QSize( fm.width(text)+10, fm.height()+4 );
}
void paintEvent( QPaintEvent * )
{
QPainter p(this);
if ( hl )
p.setPen( colorGroup().highlightedText() );
else
p.setPen( colorGroup().text() );
p.drawText( rect(), AlignCenter, text );
}
private:
bool hl;
QString text;
};
SampleWindow::SampleWindow( QWidget *parent ) : QWidget(parent), iface(0)
{
init();
}
QSize SampleWindow::sizeHint() const
{
return container->sizeHint() + QSize( 10, 35 );
}
void SampleWindow::setFont( const QFont &f )
{
QWidget::setFont( f );
popup->setFont( f );
- QTimer::singleShot ( 0, this, SLOT( fixGeometry ( )));
+ QTimer::singleShot ( 0, this, SLOT( fixGeometry()));
}
static void setStyleRecursive ( QWidget *w, QStyle *s )
{
w->setStyle( s );
QObjectList *childObjects=(QObjectList*)w->children();
if ( childObjects ) {
QObject * o;
for(o=childObjects->first();o!=0;o=childObjects->next()) {
if( o->isWidgetType() ) {
setStyleRecursive((QWidget *)o,s);
}
}
}
}
void SampleWindow::setStyle2 ( QStyle *sty, const QPalette &pal )
{
typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *, QColorGroup &, bool, bool);
extern QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl);
QPixmapCache::clear ( );
QPalette p = pal; // ette ( );
sty-> polish ( p );
qt_set_draw_menu_bar_impl ( 0 );
setStyleRecursive ( this, sty );
setPalette ( p );
- QTimer::singleShot ( 0, this, SLOT( fixGeometry ( )));
+ QTimer::singleShot ( 0, this, SLOT( fixGeometry()));
}
void SampleWindow::setDecoration( WindowDecorationInterface *i )
{
iface = i;
wd.rect = QRect( 0, 0, 150, 75 );
wd.caption = tr("Sample");
wd.palette = palette();
wd.flags = WindowDecorationInterface::WindowData::Dialog |
WindowDecorationInterface::WindowData::Active;
wd.reserved = 1;
th = iface->metric(WindowDecorationInterface::TitleHeight, &wd);
tb = iface->metric(WindowDecorationInterface::TopBorder, &wd);
lb = iface->metric(WindowDecorationInterface::LeftBorder, &wd);
rb = iface->metric(WindowDecorationInterface::RightBorder, &wd);
bb = iface->metric(WindowDecorationInterface::BottomBorder, &wd);
int yoff = th + tb;
int xoff = lb;
wd.rect.setX( 0 );
wd.rect.setWidth( width() - lb - rb );
wd.rect.setY( 0 );
wd.rect.setHeight( height() - yoff - bb );
container->setGeometry( xoff, yoff, wd.rect.width(), wd.rect.height() );
setMinimumSize( container->sizeHint().width()+lb+rb,
container->sizeHint().height()+tb+th+bb );
}
void SampleWindow::paintEvent( QPaintEvent * )
{
if ( !iface )
return;
QPainter p( this );
p.translate( lb, th+tb );
iface->drawArea(WindowDecorationInterface::Border, &p, &wd);
iface->drawArea(WindowDecorationInterface::Title, &p, &wd);
p.setPen(palette().active().color(QColorGroup::HighlightedText));
QFont f( font() );
f.setWeight( QFont::Bold );
p.setFont(f);
iface->drawArea(WindowDecorationInterface::TitleText, &p, &wd);
QRect brect( 0, -th, iface->metric(WindowDecorationInterface::HelpWidth,&wd), th );
iface->drawButton( WindowDecorationInterface::Help, &p, &wd,
brect.x(), brect.y(), brect.width(), brect.height(), (QWSButton::State)0 );
brect.moveBy( wd.rect.width() -
iface->metric(WindowDecorationInterface::OKWidth,&wd) -
iface->metric(WindowDecorationInterface::CloseWidth,&wd), 0 );
iface->drawButton( WindowDecorationInterface::Close, &p, &wd,
brect.x(), brect.y(), brect.width(), brect.height(), (QWSButton::State)0 );
brect.moveBy( iface->metric(WindowDecorationInterface::CloseWidth,&wd), 0 );
iface->drawButton( WindowDecorationInterface::OK, &p, &wd,
brect.x(), brect.y(), brect.width(), brect.height(), (QWSButton::State)0 );
}
void SampleWindow::init()
{
container = new QVBox( this );
popup = new QPopupMenu( this );
popup->insertItem( tr("Normal Item"), 1 );
popup->insertItem( tr("Disabled Item"), 2 );
popup->setItemEnabled(2, FALSE);
QMenuBar *mb = new QMenuBar( container );
mb->insertItem( tr("Menu"), popup );
QHBox *hb = new QHBox( container );
QWidget *w = new QWidget( hb );
(void)new QScrollBar( 0, 0, 0, 0, 0, Vertical, hb );
QGridLayout *gl = new QGridLayout( w, 2, 2, 4 );
SampleText *l = new SampleText( tr("Normal Text"), FALSE, w );
gl->addWidget( l, 0, 0 );
l = new SampleText( tr("Highlighted Text"), TRUE, w );
gl->addWidget( l, 1, 0 );
QPushButton *pb = new QPushButton( tr("Button"), w );
gl->addWidget( pb, 0, 1 );
pb->setFocusPolicy( NoFocus );
QCheckBox *cb = new QCheckBox( tr("Check Box"), w );
gl->addWidget( cb, 1, 1 );
cb->setFocusPolicy( NoFocus );
cb->setChecked( TRUE );
QWhatsThis::add( this, tr("Sample window using the selected settings.") );
}
bool SampleWindow::eventFilter( QObject *, QEvent *e )
diff --git a/noncore/settings/aqpkg/inputdlg.cpp b/noncore/settings/aqpkg/inputdlg.cpp
index 06e934c..30f0527 100644
--- a/noncore/settings/aqpkg/inputdlg.cpp
+++ b/noncore/settings/aqpkg/inputdlg.cpp
@@ -1,134 +1,134 @@
/*
                This file is part of the OPIE Project
=. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk>
             .=l. Dan Williams <drw@handhelds.org>
           .>+-=
 _;:,     .>    :=|. This file is free software; you can
.> <`_,   >  .   <= redistribute it and/or modify it under
:`=1 )Y*s>-.--   : the terms of the GNU General Public
.="- .-=="i,     .._ License as published by the Free Software
 - .   .-<_>     .<> Foundation; either version 2 of the License,
     ._= =}       : or (at your option) any later version.
    .%`+i>       _;_.
    .i_,=:_.      -<s. This file is distributed in the hope that
     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
    : ..    .:,     . . . without even the implied warranty of
    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
..}^=.=       =       ; Public License for more details.
++=   -.     .`     .:
 :     =  ...= . :.=- You should have received a copy of the GNU
 -.   .:....=;==+<; General Public License along with this file;
  -_. . .   )=.  = see the file COPYING. If not, write to the
    --        :-=` Free Software Foundation, Inc.,
59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <qlayout.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qspinbox.h>
#include <qcombobox.h>
#include <qwidgetstack.h>
#include <qvalidator.h>
#include <qapplication.h>
#include "inputdlg.h"
#include "global.h"
InputDialog :: InputDialog( const QString &label, QWidget* parent, const char* name,
bool modal )
: QDialog( parent, name, modal )
{
lineEdit = 0;
QVBoxLayout *vbox = new QVBoxLayout( this, 6, 6 );
QLabel* l = new QLabel( label, this );
vbox->addWidget( l );
lineEdit = new QLineEdit( this );
vbox->addWidget( lineEdit );
QHBoxLayout *hbox = new QHBoxLayout( 6 );
vbox->addLayout( hbox, AlignRight );
ok = new QPushButton( tr( "&OK" ), this );
ok->setDefault( TRUE );
QPushButton *cancel = new QPushButton( tr( "&Cancel" ), this );
QSize bs( ok->sizeHint() );
if ( cancel->sizeHint().width() > bs.width() )
bs.setWidth( cancel->sizeHint().width() );
ok->setFixedSize( bs );
cancel->setFixedSize( bs );
hbox->addWidget( new QWidget( this ) );
hbox->addWidget( ok );
hbox->addWidget( cancel );
connect( lineEdit, SIGNAL( returnPressed() ),
this, SLOT( tryAccept() ) );
- connect( lineEdit, SIGNAL( textChanged( const QString & ) ),
- this, SLOT( textChanged( const QString & ) ) );
+ connect( lineEdit, SIGNAL( textChanged(const QString&) ),
+ this, SLOT( textChanged(const QString&) ) );
connect( ok, SIGNAL( clicked() ), this, SLOT( accept() ) );
connect( cancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
resize( QMAX( sizeHint().width(), 240 ), sizeHint().height() );
}
/*!
Destructor.
*/
InputDialog::~InputDialog()
{
}
void InputDialog :: setText( const QString &text )
{
lineEdit->setText( text );
lineEdit->selectAll();
}
QString InputDialog :: getText()
{
return lineEdit->text();
}
QString InputDialog::getText( const QString &caption, const QString &label,
const QString &text, bool *ok, QWidget *parent,
const char *name )
{
InputDialog *dlg = new InputDialog( label, parent, name, true );
dlg->setCaption( caption );
dlg->setText( text );
QString result;
*ok = dlg->exec() == QDialog::Accepted;
if ( *ok )
result = dlg->getText();
delete dlg;
return result;
}
void InputDialog :: textChanged( const QString &s )
{
ok->setEnabled( !s.isEmpty() );
}
void InputDialog :: tryAccept()
{
if ( !lineEdit->text().isEmpty() )
accept();
}
diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp
index d927a36..d2babb4 100644
--- a/noncore/settings/aqpkg/installdlgimpl.cpp
+++ b/noncore/settings/aqpkg/installdlgimpl.cpp
@@ -79,321 +79,321 @@ InstallDlgImpl::InstallDlgImpl( const QList<InstallData> &packageList, DataManag
// Grab flags - Turn MAKE_LINKS on by default (if no flags found)
flags = cfg.readNumEntry( "installFlags", 0 );
infoLevel = cfg.readNumEntry( "infoLevel", 1 );
#else
flags = 0;
#endif
// Output text is read only
output->setReadOnly( true );
// QFont f( "helvetica" );
// f.setPointSize( 10 );
// output->setFont( f );
// setup destination data
int defIndex = 0;
int i;
QListIterator<Destination> dit( dataMgr->getDestinationList() );
for ( i = 0; dit.current(); ++dit, ++i )
{
destination->insertItem( dit.current()->getDestinationName() );
if ( dit.current()->getDestinationName() == defaultDest )
defIndex = i;
}
destination->setCurrentItem( defIndex );
QListIterator<InstallData> it( packageList );
// setup package data
QString remove = tr( "Remove\n" );
QString install = tr( "Install\n" );
QString upgrade = tr( "Upgrade\n" );
for ( ; it.current(); ++it )
{
InstallData *item = it.current();
InstallData *newitem = new InstallData();
newitem->option = item->option;
newitem->packageName = item->packageName;
newitem->destination = item->destination;
newitem->recreateLinks = item->recreateLinks;
packages.append( newitem );
if ( item->option == "I" )
{
install.append( QString( " %1\n" ).arg( item->packageName ) );
}
else if ( item->option == "D" )
{
remove.append( QString( " %1\n" ).arg( item->packageName ) );
}
else if ( item->option == "U" || item->option == "R" )
{
QString type;
if ( item->option == "R" )
type = tr( "(ReInstall)" );
else
type = tr( "(Upgrade)" );
upgrade.append( QString( " %1 %2\n" ).arg( item->packageName ).arg( type ) );
}
}
output->setText( QString( "%1\n%2\n%3\n" ).arg( remove ).arg( install ).arg( upgrade ) );
displayAvailableSpace( destination->currentText() );
}
InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, const char *title )
: QWidget( 0, 0, 0 )
{
setCaption( title );
init( FALSE );
pIpkg = ipkg;
output->setText( initialText );
}
InstallDlgImpl::~InstallDlgImpl()
{
if ( pIpkg )
delete pIpkg;
}
void InstallDlgImpl :: init( bool displayextrainfo )
{
QGridLayout *layout = new QGridLayout( this );
layout->setSpacing( 4 );
layout->setMargin( 4 );
if ( displayextrainfo )
{
QLabel *label = new QLabel( tr( "Destination" ), this );
layout->addWidget( label, 0, 0 );
destination = new QComboBox( FALSE, this );
layout->addWidget( destination, 0, 1 );
- connect( destination, SIGNAL( highlighted( const QString & ) ),
- this, SLOT( displayAvailableSpace( const QString & ) ) );
+ connect( destination, SIGNAL( highlighted(const QString&) ),
+ this, SLOT( displayAvailableSpace(const QString&) ) );
QLabel *label2 = new QLabel( tr( "Space Avail" ), this );
layout->addWidget( label2, 1, 0 );
txtAvailableSpace = new QLabel( "", this );
layout->addWidget( txtAvailableSpace, 1, 1 );
}
else
{
destination = 0x0;
txtAvailableSpace = 0x0;
}
QGroupBox *GroupBox2 = new QGroupBox( 0, Qt::Vertical, tr( "Output" ), this );
GroupBox2->layout()->setSpacing( 0 );
GroupBox2->layout()->setMargin( 4 );
QVBoxLayout *GroupBox2Layout = new QVBoxLayout( GroupBox2->layout() );
output = new QMultiLineEdit( GroupBox2 );
GroupBox2Layout->addWidget( output );
layout->addMultiCellWidget( GroupBox2, 2, 2, 0, 1 );
btnInstall = new QPushButton( Resource::loadPixmap( "aqpkg/apply" ), tr( "Start" ), this );
layout->addWidget( btnInstall, 3, 0 );
connect( btnInstall, SIGNAL( clicked() ), this, SLOT( installSelected() ) );
btnOptions = new QPushButton( Resource::loadPixmap( "SettingsIcon" ), tr( "Options" ), this );
layout->addWidget( btnOptions, 3, 1 );
connect( btnOptions, SIGNAL( clicked() ), this, SLOT( optionsSelected() ) );
}
void InstallDlgImpl :: optionsSelected()
{
if ( btnOptions->text() == tr( "Options" ) )
{
InstallOptionsDlgImpl opt( flags, infoLevel, this, "Option", true );
if ( opt.exec() == QDialog::Accepted )
{
// set options selected from dialog
flags = opt.getFlags();
infoLevel = opt.getInfoLevel();
#ifdef QWS
Config cfg( "aqpkg" );
cfg.setGroup( "settings" );
cfg.writeEntry( "installFlags", flags );
cfg.writeEntry( "infoLevel", infoLevel );
#endif
}
}
else // Save output
{
QMap<QString, QStringList> map;
map.insert( tr( "All" ), QStringList() );
QStringList text;
text << "text/*";
map.insert(tr( "Text" ), text );
text << "*";
map.insert( tr( "All" ), text );
QString filename = Opie::OFileDialog::getSaveFileName( 2, "/", "ipkg-output", map );
if( !filename.isEmpty() )
{
QString currentFileName = QFileInfo( filename ).fileName();
DocLnk doc;
doc.setType( "text/plain" );
doc.setFile( filename );
doc.setName( currentFileName );
FileManager fm;
fm.saveFile( doc, output->text() );
}
}
}
void InstallDlgImpl :: installSelected()
{
if ( btnInstall->text() == tr( "Abort" ) )
{
if ( pIpkg )
{
displayText( tr( "\n**** User Clicked ABORT ***" ) );
pIpkg->abort();
displayText( tr( "**** Process Aborted ****" ) );
}
btnInstall->setText( tr( "Close" ) );
btnInstall->setIconSet( Resource::loadPixmap( "enter" ) );
return;
}
else if ( btnInstall->text() == tr( "Close" ) )
{
emit reloadData( this );
return;
}
// Disable buttons
btnOptions->setEnabled( false );
// btnInstall->setEnabled( false );
btnInstall->setText( tr( "Abort" ) );
btnInstall->setIconSet( Resource::loadPixmap( "close" ) );
if ( pIpkg )
{
output->setText( "" );
- connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
+ connect( pIpkg, SIGNAL(outputText(const QString&)), this, SLOT(displayText(const QString&)));
connect( pIpkg, SIGNAL(ipkgFinished()), this, SLOT(ipkgFinished()));
pIpkg->runIpkg();
}
else
{
output->setText( "" );
Destination *d = dataMgr->getDestination( destination->currentText() );
QString dest = d->getDestinationName();
QString destDir = d->getDestinationPath();
int instFlags = flags;
if ( d->linkToRoot() )
instFlags |= MAKE_LINKS;
#ifdef QWS
// Save settings
Config cfg( "aqpkg" );
cfg.setGroup( "settings" );
cfg.writeEntry( "dest", dest );
#endif
pIpkg = new Ipkg;
- connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
+ connect( pIpkg, SIGNAL(outputText(const QString&)), this, SLOT(displayText(const QString&)));
connect( pIpkg, SIGNAL(ipkgFinished()), this, SLOT(ipkgFinished()));
firstPackage = TRUE;
ipkgFinished();
// First run through the remove list, then the install list then the upgrade list
/*
pIpkg->setOption( "remove" );
QListIterator<InstallData> it( removeList );
InstallData *idata;
for ( ; it.current(); ++it )
{
idata = it.current();
pIpkg->setDestination( idata->destination->getDestinationName() );
pIpkg->setDestinationDir( idata->destination->getDestinationPath() );
pIpkg->setPackage( idata->packageName );
int tmpFlags = flags;
if ( idata->destination->linkToRoot() )
tmpFlags |= MAKE_LINKS;
pIpkg->setFlags( tmpFlags, infoLevel );
pIpkg->runIpkg();
}
pIpkg->setOption( "install" );
pIpkg->setDestination( dest );
pIpkg->setDestinationDir( destDir );
pIpkg->setFlags( instFlags, infoLevel );
QListIterator<InstallData> it2( installList );
for ( ; it2.current(); ++it2 )
{
pIpkg->setPackage( it2.current()->packageName );
pIpkg->runIpkg();
}
flags |= FORCE_REINSTALL;
QListIterator<InstallData> it3( updateList );
for ( ; it3.current() ; ++it3 )
{
idata = it3.current();
if ( idata->option == "R" )
pIpkg->setOption( "reinstall" );
else
pIpkg->setOption( "upgrade" );
pIpkg->setDestination( idata->destination->getDestinationName() );
pIpkg->setDestinationDir( idata->destination->getDestinationPath() );
pIpkg->setPackage( idata->packageName );
int tmpFlags = flags;
if ( idata->destination->linkToRoot() && idata->recreateLinks )
tmpFlags |= MAKE_LINKS;
pIpkg->setFlags( tmpFlags, infoLevel );
pIpkg->runIpkg();
}
delete pIpkg;
pIpkg = 0;
*/
}
}
void InstallDlgImpl :: displayText(const QString &text )
{
QString newtext = QString( "%1\n%2" ).arg( output->text() ).arg( text );
/* Set a max line count for the QMultiLineEdit, as users have reported
* performance issues when line count gets extreme.
*/
if(output->numLines() >= MAXLINES)
output->removeLine(0);
output->setText( newtext );
output->setCursorPosition( output->numLines(), 0 );
}
void InstallDlgImpl :: displayAvailableSpace( const QString &text )
{
Destination *d = dataMgr->getDestination( text );
QString destDir = d->getDestinationPath();
long blockSize = 0;
long totalBlocks = 0;
long availBlocks = 0;
QString space;
if ( Utils::getStorageSpace( (const char *)destDir, &blockSize, &totalBlocks, &availBlocks ) )
{
long mult = blockSize / 1024;
long div = 1024 / blockSize;
if ( !mult ) mult = 1;
if ( !div ) div = 1;
long avail = availBlocks * mult / div;
space = tr( "%1 Kb" ).arg( avail );
diff --git a/noncore/settings/aqpkg/ipkg.cpp b/noncore/settings/aqpkg/ipkg.cpp
index 3761b67..866afed 100644
--- a/noncore/settings/aqpkg/ipkg.cpp
+++ b/noncore/settings/aqpkg/ipkg.cpp
@@ -195,200 +195,200 @@ void Ipkg :: removeStatusEntry()
tempstr = tr("package - ");
tempstr.append( package );
emit outputText( tempstr );
QFile readFile( statusFile );
QFile writeFile( outStatusFile );
if ( !readFile.open( IO_ReadOnly ) )
{
tempstr = tr("Couldn't open status file - ");
tempstr.append( statusFile );
emit outputText( tempstr );
return;
}
if ( !writeFile.open( IO_WriteOnly ) )
{
tempstr = tr("Couldn't create tempory status file - ");
tempstr.append( outStatusFile );
emit outputText( tempstr );
return;
}
int i = 0;
QTextStream readStream( &readFile );
QTextStream writeStream( &writeFile );
QString line;
char k[21];
char v[1001];
QString key;
QString value;
while ( !readStream.atEnd() )
{
//read new line
line = readStream.readLine();
if ( line.contains( ":", TRUE ) )
{
//grep key and value from line
k[0] = '\0';
v[0] = '\0';
sscanf( line, "%[^:]: %[^\n]", k, v );
key = k;
value = v;
key = key.stripWhiteSpace();
value = value.stripWhiteSpace();
} else {
key = "";
value = "";
}
if ( key == "Package" && value == package )
{
//skip lines from the deleted package
while ( ( !readStream.atEnd() ) && ( line.stripWhiteSpace() != "" ) )
{
line = readStream.readLine();
}
} else {
//write other lines into the tempfile
writeStream << line << "\n";
// Improve UI responsiveness
i++;
if ( ( i % 50 ) == 0 )
qApp->processEvents();
}
}
readFile.close();
writeFile.close();
// Remove old status file and put tmp stats file in its place
remove( statusFile );
rename( outStatusFile, statusFile );
}
int Ipkg :: executeIpkgCommand( QStringList &cmd, const QString /*option*/ )
{
// If one is already running - should never be but just to be safe
if ( proc )
{
delete proc;
proc = 0;
}
// OK we're gonna use OProcess to run this thing
proc = new OProcess();
aborted = false;
// Connect up our slots
- connect(proc, SIGNAL(processExited(OProcess *)),
+ connect(proc, SIGNAL(processExited(OProcess*)),
this, SLOT( processFinished()));
- connect(proc, SIGNAL(receivedStdout(OProcess *, char *, int)),
- this, SLOT(commandStdout(OProcess *, char *, int)));
+ connect(proc, SIGNAL(receivedStdout(OProcess*,char*,int)),
+ this, SLOT(commandStdout(OProcess*,char*,int)));
- connect(proc, SIGNAL(receivedStderr(OProcess *, char *, int)),
- this, SLOT(commandStderr(OProcess *, char *, int)));
+ connect(proc, SIGNAL(receivedStderr(OProcess*,char*,int)),
+ this, SLOT(commandStderr(OProcess*,char*,int)));
for ( QStringList::Iterator it = cmd.begin(); it != cmd.end(); ++it )
{
*proc << (*it).latin1();
}
// Start the process going
finished = false;
if(!proc->start(OProcess::NotifyOnExit, OProcess::All))
{
emit outputText( tr("Couldn't start ipkg process" ) );
}
}
void Ipkg::commandStdout(OProcess*, char *buffer, int buflen)
{
QString lineStr = buffer;
if ( lineStr[buflen-1] == '\n' )
buflen --;
lineStr = lineStr.left( buflen );
emit outputText( lineStr );
// check if we are installing dependant packages
if ( option == "install" || option == "reinstall" )
{
// Need to keep track of any dependant packages that get installed
// so that we can create links to them as necessary
if ( lineStr.startsWith( "Installing " ) )
{
int start = lineStr.find( " " ) + 1;
int end = lineStr.find( " ", start );
QString *package = new QString( lineStr.mid( start, end-start ) );
dependantPackages->append( package );
}
}
else if ( option == "remove" && !( flags & FORCE_DEPENDS ) &&
lineStr.find( "is depended upon by packages:" ) != -1 )
{
// Ipkg should send this to STDERR, but doesn't - so trap here
error = true;
}
buffer[0] = '\0';
}
void Ipkg::commandStderr(OProcess*, char *buffer, int buflen)
{
QString lineStr = buffer;
if ( lineStr[buflen-1] == '\n' )
buflen --;
lineStr=lineStr.left( buflen );
emit outputText( lineStr );
buffer[0] = '\0';
error = true;
}
void Ipkg::processFinished()
{
// Finally, if we are removing a package, remove its entry from the <destdir>/usr/lib/ipkg/status file
// to workaround an ipkg bug which stops reinstall to a different location
if ( !error && option == "remove" )
removeStatusEntry();
delete proc;
proc = 0;
finished = true;
emit ipkgFinished();
}
void Ipkg :: abort()
{
if ( proc )
{
proc->kill();
aborted = true;
}
}
void Ipkg :: linkPackage( const QString &packFileName, const QString &dest, const QString &destDir )
{
if ( dest == "root" || dest == "/" )
return;
qApp->processEvents();
QStringList *fileList = getList( packFileName, destDir );
qApp->processEvents();
processFileList( fileList, destDir );
delete fileList;
}
QStringList* Ipkg :: getList( const QString &packageFilename, const QString &destDir )
{
QString packageFileDir = destDir;
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp
index 6f5c712..6b31cd1 100644
--- a/noncore/settings/aqpkg/mainwin.cpp
+++ b/noncore/settings/aqpkg/mainwin.cpp
@@ -7,402 +7,402 @@
 _;:,     .>    :=|. This file is free software; you can
.> <`_,   >  .   <= redistribute it and/or modify it under
:`=1 )Y*s>-.--   : the terms of the GNU General Public
.="- .-=="i,     .._ License as published by the Free Software
 - .   .-<_>     .<> Foundation; either version 2 of the License,
     ._= =}       : or (at your option) any later version.
    .%`+i>       _;_.
    .i_,=:_.      -<s. This file is distributed in the hope that
     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
    : ..    .:,     . . . without even the implied warranty of
    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
..}^=.=       =       ; Public License for more details.
++=   -.     .`     .:
 :     =  ...= . :.=- You should have received a copy of the GNU
 -.   .:....=;==+<; General Public License along with this file;
  -_. . .   )=.  = see the file COPYING. If not, write to the
    --        :-=` Free Software Foundation, Inc.,
59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "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 <qpe/qpeapplication.h>
#include <qpe/config.h>
#include <qpe/resource.h>
/* QT */
#include <qmenubar.h>
#include <qtoolbar.h>
#include <qaction.h>
#include <qcombobox.h>
#include <qfile.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qlineedit.h>
#include <qlistview.h>
#include <qmenubar.h>
#include <qmessagebox.h>
#include <qpopupmenu.h>
#include <qprogressbar.h>
#include <qtimer.h>
#include <qwhatsthis.h>
#include <qwidgetstack.h>
/* STD */
#include <linux/limits.h>
#include <unistd.h>
extern int compareVersions( const char *v1, const char *v2 );
MainWindow :: MainWindow( QWidget* parent, const char* name, WFlags fl )
: QMainWindow( parent, name, fl || WStyle_ContextHelp )
{
// Disable suspend mode
QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::DisableSuspend;
LOCAL_SERVER = QObject::tr( "Installed packages" );
LOCAL_IPKGS = QObject::tr( "Local packages" );
setCaption( tr( "AQPkg - Package Manager" ) );
// Create UI widgets
initMainWidget();
initProgressWidget();
// Build menu and tool bars
setToolBarsMovable( FALSE );
QToolBar *bar = new QToolBar( this );
bar->setHorizontalStretchable( TRUE );
QMenuBar *mb = new QMenuBar( bar );
mb->setMargin( 0 );
bar = new QToolBar( this );
// Find toolbar
findBar = new QToolBar( this );
addToolBar( findBar, QMainWindow::Top, true );
findBar->setHorizontalStretchable( true );
findEdit = new QLineEdit( findBar );
QWhatsThis::add( findEdit, tr( "Type the text to search for here." ) );
findBar->setStretchableWidget( findEdit );
- connect( findEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( findPackage( const QString & ) ) );
+ connect( findEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( findPackage(const QString&) ) );
// Quick jump toolbar
jumpBar = new QToolBar( this );
addToolBar( jumpBar, QMainWindow::Top, true );
jumpBar->setHorizontalStretchable( true );
QWidget *w = new QWidget( jumpBar );
jumpBar->setStretchableWidget( w );
QGridLayout *layout = new QGridLayout( w );
char text[2];
text[1] = '\0';
for ( int i = 0 ; i < 26 ; ++i )
{
text[0] = 'A' + i;
LetterPushButton *b = new LetterPushButton( text, w );
- connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) );
+ connect( b, SIGNAL( released(QString) ), this, SLOT( letterPushed(QString) ) );
layout->addWidget( b, i / 13, i % 13);
}
QAction *a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, w, 0 );
a->setWhatsThis( tr( "Click here to hide the Quick Jump toolbar." ) );
connect( a, SIGNAL( activated() ), this, SLOT( hideJumpBar() ) );
a->addTo( jumpBar );
jumpBar->hide();
// Packages menu
QPopupMenu *popup = new QPopupMenu( this );
a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "aqpkg/update" ), QString::null, 0, this, 0 );
a->setWhatsThis( tr( "Click here to update package lists from servers." ) );
connect( a, SIGNAL( activated() ), this, SLOT( updateServer() ) );
a->addTo( popup );
a->addTo( bar );
actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "aqpkg/upgrade" ), QString::null, 0, this, 0 );
actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) );
connect( actionUpgrade, SIGNAL( activated() ), this, SLOT( upgradePackages() ) );
actionUpgrade->addTo( popup );
actionUpgrade->addTo( bar );
iconDownload = Resource::loadPixmap( "aqpkg/download" );
iconRemove = Resource::loadPixmap( "aqpkg/remove" );
actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 );
actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) );
connect( actionDownload, SIGNAL( activated() ), this, SLOT( downloadPackage() ) );
actionDownload->addTo( popup );
actionDownload->addTo( bar );
a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "aqpkg/apply" ), QString::null, 0, this, 0 );
a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) );
connect( a, SIGNAL( activated() ), this, SLOT( applyChanges() ) );
a->addTo( popup );
a->addTo( bar );
popup->insertSeparator();
a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 );
a->setWhatsThis( tr( "Click here to configure this application." ) );
connect( a, SIGNAL( activated() ), this, SLOT( displaySettings() ) );
a->addTo( popup );
mb->insertItem( tr( "Actions" ), popup );
// View menu
popup = new QPopupMenu( this );
actionUninstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 );
actionUninstalled->setToggleAction( TRUE );
actionUninstalled->setWhatsThis( tr( "Click here to show packages available which have not been installed." ) );
connect( actionUninstalled, SIGNAL( activated() ), this, SLOT( filterUninstalledPackages() ) );
actionUninstalled->addTo( popup );
actionInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 );
actionInstalled->setToggleAction( TRUE );
actionInstalled->setWhatsThis( tr( "Click here to show packages currently installed on this device." ) );
connect( actionInstalled, SIGNAL( activated() ), this, SLOT( filterInstalledPackages() ) );
actionInstalled->addTo( popup );
actionUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 );
actionUpdated->setToggleAction( TRUE );
actionUpdated->setWhatsThis( tr( "Click here to show packages currently installed on this device which have a newer version available." ) );
connect( actionUpdated, SIGNAL( activated() ), this, SLOT( filterUpgradedPackages() ) );
actionUpdated->addTo( popup );
popup->insertSeparator();
actionFilter = new QAction( tr( "Filter by category" ), Resource::loadPixmap( "aqpkg/filter" ), QString::null, 0, this, 0 );
actionFilter->setToggleAction( TRUE );
actionFilter->setWhatsThis( tr( "Click here to list packages belonging to one category." ) );
connect( actionFilter, SIGNAL( activated() ), this, SLOT( filterCategory() ) );
actionFilter->addTo( popup );
a = new QAction( tr( "Set filter category" ), QString::null, 0, this, 0 );
a->setWhatsThis( tr( "Click here to change package category to used filter." ) );
connect( a, SIGNAL( activated() ), this, SLOT( setFilterCategory() ) );
a->addTo( popup );
popup->insertSeparator();
a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 );
a->setWhatsThis( tr( "Click here to search for text in package names." ) );
connect( a, SIGNAL( activated() ), this, SLOT( displayFindBar() ) );
a->addTo( popup );
actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 );
actionFindNext->setEnabled( FALSE );
actionFindNext->setWhatsThis( tr( "Click here to find the next package name containing the text you are searching for." ) );
connect( actionFindNext, SIGNAL( activated() ), this, SLOT( repeatFind() ) );
actionFindNext->addTo( popup );
actionFindNext->addTo( findBar );
popup->insertSeparator();
a = new QAction( tr( "Quick Jump keypad" ), Resource::loadPixmap( "aqpkg/keyboard" ), QString::null, 0, this, 0 );
a->setWhatsThis( tr( "Click here to display/hide keypad to allow quick movement through the package list." ) );
connect( a, SIGNAL( activated() ), this, SLOT( displayJumpBar() ) );
a->addTo( popup );
mb->insertItem( tr( "View" ), popup );
// Finish find toolbar creation
a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
a->setWhatsThis( tr( "Click here to hide the find toolbar." ) );
connect( a, SIGNAL( activated() ), this, SLOT( hideFindBar() ) );
a->addTo( findBar );
findBar->hide();
// Create widget stack and add UI widgets
stack = new QWidgetStack( this );
stack->addWidget( progressWindow, 2 );
stack->addWidget( networkPkgWindow, 1 );
setCentralWidget( stack );
stack->raiseWidget( progressWindow );
// Delayed call to finish initialization
QTimer::singleShot( 100, this, SLOT( init() ) );
}
MainWindow :: ~MainWindow()
{
delete mgr;
// Reenable suspend mode
QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
}
void MainWindow :: initMainWidget()
{
networkPkgWindow = new QWidget( this );
QLabel *l = new QLabel( tr( "Servers:" ), networkPkgWindow );
serversList = new QComboBox( networkPkgWindow );
connect( serversList, SIGNAL(activated(int)), this, SLOT(serverSelected(int)) );
QWhatsThis::add( serversList, tr( "Click here to select a package feed." ) );
installedIcon = Resource::loadPixmap( "installed" );
updatedIcon = Resource::loadPixmap( "aqpkg/updated" );
packagesList = new QListView( networkPkgWindow );
packagesList->addColumn( tr( "Packages" ), 225 );
QWhatsThis::add( packagesList, tr( "This is a listing of all packages for the server feed selected above.\n\nA blue dot next to the package name indicates that the package is currently installed.\n\nA blue dot with a star indicates that a newer version of the package is available from the server feed.\n\nClick inside the box at the left to select a package." ) );
QPEApplication::setStylusOperation( packagesList->viewport(), QPEApplication::RightOnHold );
- connect( packagesList, SIGNAL(rightButtonPressed(QListViewItem *,const QPoint &,int)),
- this, SLOT(slotDisplayPackage(QListViewItem *)) );
+ connect( packagesList, SIGNAL(rightButtonPressed(QListViewItem*,const QPoint&,int)),
+ this, SLOT(slotDisplayPackage(QListViewItem*)) );
QVBoxLayout *vbox = new QVBoxLayout( networkPkgWindow, 0, -1 );
QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1 );
hbox1->addWidget( l );
hbox1->addWidget( serversList );
vbox->addWidget( packagesList );
downloadEnabled = TRUE;
}
void MainWindow :: initProgressWidget()
{
progressWindow = new QWidget( this );
QVBoxLayout *layout = new QVBoxLayout( progressWindow, 4, 4 );
m_status = new QLabel( progressWindow );
m_status->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
layout->addWidget( m_status );
m_progress = new QProgressBar( progressWindow );
layout->addWidget( m_progress );
}
void MainWindow :: init()
{
#ifdef QWS
// read download directory from config file
Config cfg( "aqpkg" );
cfg.setGroup( "settings" );
currentlySelectedServer = cfg.readEntry( "selectedServer", "local" );
// showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" );
#endif
stack->raiseWidget( progressWindow );
mgr = new DataManager();
- connect( mgr, SIGNAL( progressSetSteps( int ) ), this, SLOT( setProgressSteps( int ) ) );
- connect( mgr, SIGNAL( progressSetMessage( const QString & ) ),
- this, SLOT( setProgressMessage( const QString & ) ) );
- connect( mgr, SIGNAL( progressUpdate( int ) ), this, SLOT( updateProgress( int ) ) );
+ connect( mgr, SIGNAL( progressSetSteps(int) ), this, SLOT( setProgressSteps(int) ) );
+ connect( mgr, SIGNAL( progressSetMessage(const QString&) ),
+ this, SLOT( setProgressMessage(const QString&) ) );
+ connect( mgr, SIGNAL( progressUpdate(int) ), this, SLOT( updateProgress(int) ) );
mgr->loadServers();
showUninstalledPkgs = false;
showInstalledPkgs = false;
showUpgradedPkgs = false;
categoryFilterEnabled = false;
updateData();
stack->raiseWidget( networkPkgWindow );
}
void MainWindow :: setDocument( const QString &doc )
{
// Remove path from package
QString package = Utils::getPackageNameFromIpkFilename( doc );
// First select local server
for ( int i = 0 ; i < serversList->count() ; ++i )
{
if ( serversList->text( i ) == LOCAL_IPKGS )
{
serversList->setCurrentItem( i );
break;
}
}
serverSelected( 0 );
// Now set the check box of the selected package
for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
item != 0 ;
item = (QCheckListItem *)item->nextSibling() )
{
if ( item->text().startsWith( package ) )
{
item->setOn( true );
break;
}
}
}
void MainWindow :: displaySettings()
{
SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true );
if ( dlg->showDlg() )
{
stack->raiseWidget( progressWindow );
updateData();
stack->raiseWidget( networkPkgWindow );
}
delete dlg;
}
void MainWindow :: closeEvent( QCloseEvent *e )
{
// If install dialog is visible, return to main view, otherwise close app
QWidget *widget = stack->visibleWidget();
if ( widget != networkPkgWindow && widget != progressWindow )
{
if ( widget ) delete widget;
stack->raiseWidget( networkPkgWindow );
e->ignore();
}
else
{
e->accept();
}
}
void MainWindow :: displayFindBar()
{
findBar->show();
findEdit->setFocus();
}
void MainWindow :: displayJumpBar()
{
jumpBar->show();
}
void MainWindow :: repeatFind()
{
searchForPackage( findEdit->text() );
}
void MainWindow :: findPackage( const QString &text )
{
actionFindNext->setEnabled( !text.isEmpty() );
searchForPackage( text );
}
void MainWindow :: hideFindBar()
{
findBar->hide();
}
@@ -677,411 +677,411 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
// If the local server, only display installed packages
if ( serverName == LOCAL_SERVER && !package->isInstalled() )
continue;
QCheckListItem *item = new QCheckListItem( packagesList, package->getPackageName(),
QCheckListItem::CheckBox );
if ( package->isInstalled() )
{
// If a different version of package is available, show update available icon
// Otherwise, show installed icon
if ( package->getNewVersionAvailable())
{
item->setPixmap( 0, updatedIcon );
}
else
{
item->setPixmap( 0, installedIcon );
}
}
else
{
item->setPixmap( 0, nullIcon );
}
packagesList->insertItem( item );
}
// If the local server or the local ipkgs server disable the download button
if ( serverName == LOCAL_SERVER )
{
downloadEnabled = TRUE;
actionUpgrade->setEnabled( FALSE );
}
else if ( serverName == LOCAL_IPKGS )
{
downloadEnabled = FALSE;
actionUpgrade->setEnabled( FALSE );
}
else
{
downloadEnabled = TRUE;
actionUpgrade->setEnabled( TRUE );
}
enableDownload( downloadEnabled );
// Display this widget once everything is done
if ( doProgress && raiseProgress )
{
stack->raiseWidget( networkPkgWindow );
}
}
void MainWindow :: searchForPackage( const QString &text )
{
if ( !text.isEmpty() )
{
// look through package list for text startng at current position
QCheckListItem *start = (QCheckListItem *)packagesList->currentItem();
if ( start == 0 )
start = (QCheckListItem *)packagesList->firstChild();
for ( QCheckListItem *item = start; item != 0 ;
item = (QCheckListItem *)item->nextSibling() )
{
if ( item->text().lower().find( text ) != -1 )
{
packagesList->ensureItemVisible( item );
packagesList->setCurrentItem( item );
break;
}
}
}
}
void MainWindow :: updateServer()
{
QString serverName = serversList->currentText();
// Update the current server
// Display dialog
// Disable buttons to stop silly people clicking lots on them :)
// First, write out ipkg_conf file so that ipkg can use it
mgr->writeOutIpkgConf();
Ipkg *ipkg = new Ipkg;
ipkg->setOption( "update" );
InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Refreshing server package lists" ),
tr( "Update lists" ) );
- connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) );
+ connect( dlg, SIGNAL( reloadData(InstallDlgImpl*) ), this, SLOT( reloadData(InstallDlgImpl*) ) );
reloadDocuments = FALSE;
stack->addWidget( dlg, 3 );
stack->raiseWidget( dlg );
// delete progDlg;
}
void MainWindow :: upgradePackages()
{
// We're gonna do an upgrade of all packages
// First warn user that this isn't recommended
// 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 );
warn.adjustSize();
if ( warn.exec() == QMessageBox::Yes )
{
// First, write out ipkg_conf file so that ipkg can use it
mgr->writeOutIpkgConf();
// Now run upgrade
Ipkg *ipkg = new Ipkg;
ipkg->setOption( "upgrade" );
InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Upgrading installed packages" ),
tr ( "Upgrade" ) );
- connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) );
+ connect( dlg, SIGNAL( reloadData(InstallDlgImpl*) ), this, SLOT( reloadData(InstallDlgImpl*) ) );
reloadDocuments = TRUE;
stack->addWidget( dlg, 3 );
stack->raiseWidget( dlg );
}
}
void MainWindow :: downloadPackage()
{
bool doUpdate = true;
if ( downloadEnabled )
{
// See if any packages are selected
bool found = false;
if ( serversList->currentText() != LOCAL_SERVER )
{
for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
item != 0 && !found;
item = (QCheckListItem *)item->nextSibling() )
{
if ( item->isOn() )
found = true;
}
}
// If user selected some packages then download the and store the locally
// otherwise, display dialog asking user what package to download from an http server
// and whether to install it
if ( found )
downloadSelectedPackages();
else
downloadRemotePackage();
}
else
{
doUpdate = false;
for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
item != 0 ;
item = (QCheckListItem *)item->nextSibling() )
{
if ( item->isOn() )
{
QString name = item->text();
int pos = name.find( "*" );
name.truncate( pos );
// if (there is a (installed), remove it
pos = name.find( "(installed)" );
if ( pos > 0 )
name.truncate( pos - 1 );
Package *p = mgr->getServer( serversList->currentText() )->getPackage( name );
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 )
{
doUpdate = true;
QFile f( p->getFilename() );
f.remove();
}
}
}
}
if ( doUpdate )
{
reloadData( 0x0 );
}
}
void MainWindow :: downloadSelectedPackages()
{
// First, write out ipkg_conf file so that ipkg can use it
mgr->writeOutIpkgConf();
// Display dialog to user asking where to download the files to
bool ok = FALSE;
QString dir = "";
#ifdef QWS
// read download directory from config file
Config cfg( "aqpkg" );
cfg.setGroup( "settings" );
dir = cfg.readEntry( "downloadDir", "/home/root/Documents/application/ipkg" );
#endif
QString text = InputDialog::getText( tr( "Download to where" ), tr( "Enter path to download to" ), dir, &ok, this );
if ( ok && !text.isEmpty() )
dir = text; // user entered something and pressed ok
else
return; // user entered nothing or pressed cancel
#ifdef QWS
// Store download directory in config file
cfg.writeEntry( "downloadDir", dir );
#endif
// Get starting directory
char initDir[PATH_MAX];
getcwd( initDir, PATH_MAX );
// Download each package
Ipkg ipkg;
- connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
+ connect( &ipkg, SIGNAL(outputText(const QString&)), this, SLOT(displayText(const QString&)));
ipkg.setOption( "download" );
ipkg.setRuntimeDirectory( dir );
for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
item != 0 ;
item = (QCheckListItem *)item->nextSibling() )
{
if ( item->isOn() )
{
ipkg.setPackage( item->text() );
ipkg.runIpkg( );
}
}
}
void MainWindow :: downloadRemotePackage()
{
// Display dialog
bool ok;
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;
// grab details from dialog
// QString package = dlg.getPackageLocation();
InstallData *item = new InstallData();
item->option = "I";
item->packageName = package;
QList<InstallData> workingPackages;
workingPackages.setAutoDelete( TRUE );
workingPackages.append( item );
InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Download" ) );
- connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) );
+ connect( dlg, SIGNAL( reloadData(InstallDlgImpl*) ), this, SLOT( reloadData(InstallDlgImpl*) ) );
reloadDocuments = TRUE;
stack->addWidget( dlg, 3 );
stack->raiseWidget( dlg );
}
void MainWindow :: applyChanges()
{
stickyOption = "";
// First, write out ipkg_conf file so that ipkg can use it
mgr->writeOutIpkgConf();
// Now for each selected item
// deal with it
QList<InstallData> workingPackages;
workingPackages.setAutoDelete( TRUE );
for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
item != 0 ;
item = (QCheckListItem *)item->nextSibling() )
{
if ( item->isOn() )
{
InstallData *instdata = dealWithItem( item );
if ( instdata )
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" ) );
return;
}
// do the stuff
InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Apply changes" ) );
- connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) );
+ connect( dlg, SIGNAL( reloadData(InstallDlgImpl*) ), this, SLOT( reloadData(InstallDlgImpl*) ) );
reloadDocuments = TRUE;
stack->addWidget( dlg, 3 );
stack->raiseWidget( dlg );
}
// decide what to do - either remove, upgrade or install
// Current rules:
// If not installed - install
// If installed and different version available - upgrade
// If installed and version up to date - remove
InstallData *MainWindow :: dealWithItem( QCheckListItem *item )
{
QString name = item->text();
// Get package
Server *s = mgr->getServer( serversList->currentText() );
Package *p = s->getPackage( name );
// If the package has a filename then it is a local file
if ( p->isPackageStoredLocally() )
name = p->getFilename();
QString option;
QString dest = "root";
if ( !p->isInstalled() )
{
InstallData *newitem = new InstallData();
newitem->option = "I";
newitem->packageName = name;
return newitem;
}
else
{
InstallData *newitem = new InstallData();
newitem->option = "D";
// If local file, remove using package name, not filename
if ( p->isPackageStoredLocally() )
name = item->text();
if ( !p->isPackageStoredLocally() )
newitem->packageName = p->getInstalledPackageName();
else
newitem->packageName = name;
if ( p->getInstalledTo() )
{
newitem->destination = p->getInstalledTo();
}
else
{
newitem->destination = p->getLocalPackage()->getInstalledTo();
}
// Now see if version is newer or not
int val = compareVersions( p->getInstalledVersion(), p->getVersion() );
// If the version requested is older and user selected a local ipk file, then reinstall the file
if ( p->isPackageStoredLocally() && val == -1 )
val = 0;
if ( val == -2 )
{
// Error - should handle
}
else if ( val == -1 )
{
// Version available is older - remove only
newitem->option = "D";
// If local file, remove using package name, not filename
if ( p->isPackageStoredLocally() )
name = item->text();
}
else
{
QString caption;
QString text;
QString secondButton;
QString secondOption;
if ( val == 0 )
{
// Version available is the same - option to remove or reinstall
caption = tr( "Do you wish to remove or reinstall\n%1?" );
text = tr( "Remove or ReInstall" );
secondButton = tr( "ReInstall" );
secondOption = "R"; // Internal action code, do not translate
}
else if ( val == 1 )
{
// Version available is newer - option to remove or upgrade
caption = tr( "Do you wish to remove or upgrade\n%1?" );
text = tr( "Remove or Upgrade" );
secondButton = tr( "Upgrade" );
secondOption = "U"; // Internal action code, do not translate
}
// Sticky option not implemented yet, but will eventually allow
diff --git a/noncore/settings/aqpkg/settingsimpl.cpp b/noncore/settings/aqpkg/settingsimpl.cpp
index 6e9dd99..b9dbb6e 100644
--- a/noncore/settings/aqpkg/settingsimpl.cpp
+++ b/noncore/settings/aqpkg/settingsimpl.cpp
@@ -18,251 +18,251 @@
  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
..}^=.=       =       ; Public License for more details.
++=   -.     .`     .:
 :     =  ...= . :.=- You should have received a copy of the GNU
 -.   .:....=;==+<; General Public License along with this file;
  -_. . .   )=.  = see the file COPYING. If not, write to the
    --        :-=` Free Software Foundation, Inc.,
59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "settingsimpl.h"
#include "global.h"
/* OPIE */
#include <opie2/otabwidget.h>
#ifdef QWS
#include <qpe/config.h>
#include <qpe/resource.h>
#endif
#include <qpe/qpeapplication.h>
/* QT */
#include <qcheckbox.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qlineedit.h>
#include <qlistbox.h>
#include <qpushbutton.h>
/* STD */
#include <fstream>
#include <algorithm>
using namespace std;
SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl )
: QDialog( parent, name, modal, fl )
{
setCaption( tr( "Configuration" ) );
// Setup layout to make everything pretty
QVBoxLayout *layout = new QVBoxLayout( this );
layout->setMargin( 2 );
layout->setSpacing( 4 );
// Setup tabs for all info
Opie::OTabWidget *tabwidget = new Opie::OTabWidget( this );
layout->addWidget( tabwidget );
tabwidget->addTab( initServerTab(), "aqpkg/servertab", tr( "Servers" ) );
tabwidget->addTab( initDestinationTab(), "aqpkg/desttab", tr( "Destinations" ) );
tabwidget->addTab( initProxyTab(), "aqpkg/proxytab", tr( "Proxies" ) );
tabwidget->setCurrentTab( tr( "Servers" ) );
dataMgr = dataManager;
setupData();
changed = false;
newserver = false;
newdestination = false;
}
SettingsImpl :: ~SettingsImpl()
{
}
bool SettingsImpl :: showDlg()
{
QPEApplication::execDialog( this );
if ( changed )
dataMgr->writeOutIpkgConf();
return changed;
}
QWidget *SettingsImpl :: initServerTab()
{
QWidget *control = new QWidget( this );
QVBoxLayout *vb = new QVBoxLayout( control );
QScrollView *sv = new QScrollView( control );
vb->addWidget( sv, 0, 0 );
sv->setResizePolicy( QScrollView::AutoOneFit );
sv->setFrameStyle( QFrame::NoFrame );
QWidget *container = new QWidget( sv->viewport() );
sv->addChild( container );
QGridLayout *layout = new QGridLayout( container );
layout->setSpacing( 2 );
layout->setMargin( 4 );
servers = new QListBox( container );
servers->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) );
- connect( servers, SIGNAL( highlighted( int ) ), this, SLOT( editServer( int ) ) );
+ connect( servers, SIGNAL( highlighted(int) ), this, SLOT( editServer(int) ) );
layout->addMultiCellWidget( servers, 0, 0, 0, 1 );
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 );
grplayout->addWidget( servername, 0, 1 );
label = new QLabel( tr( "Address:" ), grpbox );
grplayout->addWidget( label, 1, 0 );
serverurl = new QLineEdit( grpbox );
grplayout->addWidget( serverurl, 1, 1 );
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;
}
QWidget *SettingsImpl :: initDestinationTab()
{
QWidget *control = new QWidget( this );
QVBoxLayout *vb = new QVBoxLayout( control );
QScrollView *sv = new QScrollView( control );
vb->addWidget( sv, 0, 0 );
sv->setResizePolicy( QScrollView::AutoOneFit );
sv->setFrameStyle( QFrame::NoFrame );
QWidget *container = new QWidget( sv->viewport() );
sv->addChild( container );
QGridLayout *layout = new QGridLayout( container );
layout->setSpacing( 2 );
layout->setMargin( 4 );
destinations = new QListBox( container );
destinations->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) );
- connect( destinations, SIGNAL( highlighted( int ) ), this, SLOT( editDestination( int ) ) );
+ connect( destinations, SIGNAL( highlighted(int) ), this, SLOT( editDestination(int) ) );
layout->addMultiCellWidget( destinations, 0, 0, 0, 1 );
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 );
grplayout->addWidget( destinationname, 0, 1 );
label = new QLabel( tr( "Location:" ), grpbox );
grplayout->addWidget( label, 1, 0 );
destinationurl = new QLineEdit( grpbox );
grplayout->addWidget( destinationurl, 1, 1 );
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;
}
QWidget *SettingsImpl :: initProxyTab()
{
QWidget *control = new QWidget( this );
QVBoxLayout *vb = new QVBoxLayout( control );
QScrollView *sv = new QScrollView( control );
vb->addWidget( sv, 0, 0 );
sv->setResizePolicy( QScrollView::AutoOneFit );
sv->setFrameStyle( QFrame::NoFrame );
QWidget *container = new QWidget( sv->viewport() );
sv->addChild( container );
QGridLayout *layout = new QGridLayout( container );
layout->setSpacing( 2 );
layout->setMargin( 4 );
QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "HTTP Proxy" ), container );
grpbox->layout()->setSpacing( 2 );
grpbox->layout()->setMargin( 4 );
layout->addMultiCellWidget( grpbox, 0, 0, 0, 1 );
QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() );
txtHttpProxy = new QLineEdit( grpbox );
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 );
layout->addMultiCellWidget( grpbox, 1, 1, 0, 1 );
grplayout = new QVBoxLayout( grpbox->layout() );
txtFtpProxy = new QLineEdit( grpbox );
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 );
layout->addWidget( txtUsername, 2, 1 );
label = new QLabel( tr( "Password:" ), container );
layout->addWidget( label, 3, 0 );
txtPassword = new QLineEdit( container );
layout->addWidget( txtPassword, 3, 1 );
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;
}
void SettingsImpl :: setupData()
{
// add servers
QString serverName;
diff --git a/noncore/settings/backup/backuprestore.cpp b/noncore/settings/backup/backuprestore.cpp
index 977c283..6b83bc9 100644
--- a/noncore/settings/backup/backuprestore.cpp
+++ b/noncore/settings/backup/backuprestore.cpp
@@ -1,151 +1,151 @@
#include "backuprestore.h"
#include "errordialog.h"
/* OPIE */
#include <opie2/ostorageinfo.h>
#include <qpe/qpeapplication.h>
/* QT */
#include <qapplication.h>
#include <qmultilineedit.h>
#include <qdir.h>
#include <qfile.h>
#include <qfileinfo.h>
#include <qlistview.h>
#include <qpushbutton.h>
#include <qheader.h>
#include <qpe/resource.h>
#include <qpe/config.h>
#include <qmessagebox.h>
#include <qcombobox.h>
#include <qlist.h>
#include <stdlib.h>
#include <qregexp.h>
#include <qtextstream.h>
#include <qtextview.h>
/* STD */
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include <dirent.h>
#define HEADER_NAME 0
#define HEADER_BACKUP 1
#define BACKUP_LOCATION 2
#define EXTENSION ".bck"
const QString tempFileName = "/tmp/backup.err";
BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name, WFlags fl)
: BackupAndRestoreBase(parent, name, fl)
{
backupList->header()->hide();
restoreList->header()->hide();
connect(backupButton, SIGNAL(clicked()),
this, SLOT(backup()));
connect(restoreButton, SIGNAL(clicked()),
this, SLOT(restore()));
- connect(backupList, SIGNAL(clicked( QListViewItem * )),
+ connect(backupList, SIGNAL(clicked(QListViewItem*)),
this, SLOT(selectItem(QListViewItem*)));
- connect(restoreSource, SIGNAL(activated( int )),
+ connect(restoreSource, SIGNAL(activated(int)),
this, SLOT(sourceDirChanged(int)));
connect(updateList, SIGNAL(clicked()),
this, SLOT( fileListUpdate()));
//add directorys for backing up
applicationSettings = new QListViewItem(backupList, "Application Settings", "", "Settings/");
selectItem(applicationSettings);
applicationSettings = new QListViewItem(backupList, "Application Data", "", "Applications/");
selectItem(applicationSettings);
documents= new QListViewItem(backupList, "Documents", "", "Documents/");
selectItem(documents);
scanForApplicationSettings();
OStorageInfo storage;
backupLocations.insert( "Documents", QDir::homeDirPath() + "/Documents" );
if ( storage.hasCf() )
{
backupLocations.insert( "CF", storage.cfPath() );
qDebug( "Cf Path: " + storage.cfPath() );
}
if ( storage.hasSd() )
{
backupLocations.insert( "SD", storage.sdPath() );
qDebug( " Sd Path: " + storage.sdPath() );
}
if ( storage.hasMmc() )
{
backupLocations.insert( "MMC", storage.mmcPath() );
qDebug( "Mmc Path: " + storage.mmcPath() );
}
Config config("BackupAndRestore");
//read last locations
config.setGroup("LastLocation");
QString lastStoreLocation = config.readEntry( "LastStoreLocation", "" );
QString lastRestoreLocation = config.readEntry( "LastRestoreLocation", "" );
int locationIndex = 0;
QMap<QString, QString>::Iterator it;
for( it = backupLocations.begin(); it != backupLocations.end(); ++it )
{
storeToLocation->insertItem(it.key());
restoreSource->insertItem(it.key());
//check for last locations
if ( it.key() == lastStoreLocation )
storeToLocation->setCurrentItem( locationIndex );
if ( it.key() == lastRestoreLocation )
restoreSource->setCurrentItem( locationIndex );
locationIndex++;
}
// Read the list of items to ignore.
QList<QString> dontBackupList;
dontBackupList.setAutoDelete(true);
config.setGroup("DontBackup");
int total = config.readNumEntry("Total", 0);
for(int i = 0; i < total; i++)
{
dontBackupList.append(new QString(config.readEntry(QString("%1").arg(i), "")));
}
QList<QListViewItem> list;
getAllItems(backupList->firstChild(), list);
for(uint i = 0; i < list.count(); i++)
{
QString text = list.at(i)->text(HEADER_NAME);
for(uint i2 = 0; i2 < dontBackupList.count(); i2++)
{
if(*dontBackupList.at(i2) == text)
{
selectItem(list.at(i));
break;
}
}
}
QPEApplication::showWidget( this );
}
BackupAndRestore::~BackupAndRestore()
{
QList<QListViewItem> list;
getAllItems(backupList->firstChild(), list);
Config config("BackupAndRestore");
config.setGroup("DontBackup");
config.clearGroup();
int count = 0;
for(uint i = 0; i < list.count(); i++)
{
if(list.at(i)->text(HEADER_BACKUP) == "")
{
diff --git a/noncore/settings/netsystemtime/mainwindow.cpp b/noncore/settings/netsystemtime/mainwindow.cpp
index 7df41d4..c995d6e 100644
--- a/noncore/settings/netsystemtime/mainwindow.cpp
+++ b/noncore/settings/netsystemtime/mainwindow.cpp
@@ -1,199 +1,199 @@
/*
                This file is part of the OPIE Project
=.
             .=l. Copyright (c) 2002 OPIE team <opie@handhelds.org?>
           .>+-=
 _;:,     .>    :=|. This file is free software; you can
.> <`_,   >  .   <= redistribute it and/or modify it under
:`=1 )Y*s>-.--   : the terms of the GNU General Public
.="- .-=="i,     .._ License as published by the Free Software
 - .   .-<_>     .<> Foundation; either version 2 of the License,
     ._= =}       : or (at your option) any later version.
    .%`+i>       _;_.
    .i_,=:_.      -<s. This file is distributed in the hope that
     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
    : ..    .:,     . . . without even the implied warranty of
    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
..}^=.=       =       ; Public License for more details.
++=   -.     .`     .:
 :     =  ...= . :.=- You should have received a copy of the GNU
 -.   .:....=;==+<; General Public License along with this file;
  -_. . .   )=.  = see the file COPYING. If not, write to the
    --        :-=` Free Software Foundation, Inc.,
59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "mainwindow.h"
#include "timetabwidget.h"
#include "formattabwidget.h"
#include "settingstabwidget.h"
#include "ntptabwidget.h"
#include "predicttabwidget.h"
#include <qpe/config.h>
#include <qpe/datebookdb.h>
#include <qpe/qpeapplication.h>
#include <qpe/qpedialog.h>
#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP)
#include <qpe/qcopenvelope_qws.h>
#endif
#include <qlayout.h>
#include <qmessagebox.h>
#include <qsocket.h>
#include <qstring.h>
#include <qtimer.h>
MainWindow::MainWindow( QWidget *parent , const char *name, bool modal, WFlags f )
: QDialog( 0x0, 0x0, TRUE, 0 )
{
setCaption( tr( "SystemTime" ) );
QVBoxLayout *layout = new QVBoxLayout( this );
layout->setMargin( 2 );
layout->setSpacing( 4 );
// Create main tabbed control
mainWidget = new OTabWidget( this );
// Default object pointers to null
ntpProcess = 0x0;
ntpTab = 0x0;
// Add tab widgets
mainWidget->addTab( timeTab = new TimeTabWidget( mainWidget ), "netsystemtime/DateTime", tr( "Time" ) );
mainWidget->addTab( formatTab = new FormatTabWidget( mainWidget ), "netsystemtime/formattab", tr( "Format" ) );
mainWidget->addTab( settingsTab = new SettingsTabWidget( mainWidget ), "SettingsIcon", tr( "Settings" ) );
mainWidget->addTab( predictTab = new PredictTabWidget( mainWidget ), "netsystemtime/predicttab", tr( "Predict" ) );
Config config( "ntp" );
config.setGroup( "settings" );
slotDisplayNTPTab( config.readBoolEntry( "displayNtpTab", FALSE ) );
slotDisplayPredictTab( config.readBoolEntry( "displayPredictTab", FALSE ) );
mainWidget->setCurrentTab( tr( "Time" ) );
layout->addWidget( mainWidget );
- connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)),
- this, SLOT(slotQCopReceive(const QCString&, const QByteArray&)) );
+ connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)),
+ this, SLOT(slotQCopReceive(const QCString&,const QByteArray&)) );
// Create NTP socket
ntpSock = new QSocket( this );
connect( ntpSock, SIGNAL(error(int)),SLOT(slotCheckNtp(int)) );
slotProbeNTPServer();
// Create timer for automatic time lookups
ntpTimer = new QTimer( this );
// Connect everything together
connect( timeTab, SIGNAL(getNTPTime()), this, SLOT(slotGetNTPTime()) );
- connect( timeTab, SIGNAL(tzChanged(const QString &)), predictTab, SLOT(slotTZChanged(const QString &)) );
+ connect( timeTab, SIGNAL(tzChanged(const QString&)), predictTab, SLOT(slotTZChanged(const QString&)) );
connect( timeTab, SIGNAL(getPredictedTime()), predictTab, SLOT(slotSetPredictedTime()) );
- connect( formatTab, SIGNAL(show12HourTime(int)), timeTab, SLOT(slotUse12HourTime( int )) );
- connect( formatTab, SIGNAL(dateFormatChanged(const DateFormat &)),
- timeTab, SLOT(slotDateFormatChanged(const DateFormat &)) );
+ connect( formatTab, SIGNAL(show12HourTime(int)), timeTab, SLOT(slotUse12HourTime(int)) );
+ connect( formatTab, SIGNAL(dateFormatChanged(const DateFormat&)),
+ timeTab, SLOT(slotDateFormatChanged(const DateFormat&)) );
connect( formatTab, SIGNAL(weekStartChanged(int)), timeTab, SLOT(slotWeekStartChanged(int)) );
connect( settingsTab, SIGNAL(ntpDelayChanged(int)), this, SLOT(slotNTPDelayChanged(int)) );
connect( settingsTab, SIGNAL(displayNTPTab(bool)), this, SLOT(slotDisplayNTPTab(bool)) );
connect( settingsTab, SIGNAL(displayPredictTab(bool)), this, SLOT(slotDisplayPredictTab(bool)) );
- connect( predictTab, SIGNAL(setTime(const QDateTime &)), this, SLOT(slotSetTime(const QDateTime &)) );
+ connect( predictTab, SIGNAL(setTime(const QDateTime&)), this, SLOT(slotSetTime(const QDateTime&)) );
// Do initial time server check
slotNTPDelayChanged( config.readNumEntry( "ntpRefreshFreq", 1440 ) );
slotCheckNtp( -1 );
// Display app
//showMaximized();
(void)new QPEDialogListener(this);
}
MainWindow::~MainWindow()
{
if ( ntpProcess )
delete ntpProcess;
}
void MainWindow::accept()
{
// Turn off the screensaver (Note: needs to be encased in { } so that it deconstructs and sends)
{
QCopEnvelope disableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" );
disableScreenSaver << 0 << 0 << 0;
}
// Update the systemtime
timeTab->saveSettings( TRUE );
// Save format options
formatTab->saveSettings( TRUE );
// Save settings options
settingsTab->saveSettings();
// Since time has changed quickly load in the DateBookDB to allow the alarm server to get a better
// grip on itself (example re-trigger alarms for when we travel back in time).
DateBookDB db;
// Turn back on the screensaver
QCopEnvelope enableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" );
enableScreenSaver << -1 << -1 << -1;
// Exit app
qApp->quit();
}
void MainWindow::reject()
{
// Reset time settings
timeTab->saveSettings( FALSE );
// Send notifications but do not save settings
formatTab->saveSettings( FALSE );
// Exit app
qApp->quit();
}
void MainWindow::runNTP()
{
if ( !ntpDelayElapsed() && ntpInteractive )
{
QString msg = tr( "You asked for a delay of %1 minutes, but only %2 minutes elapsed since last lookup.<br>Continue?" ).arg( QString::number( ntpDelay ) ).arg( QString::number( _lookupDiff / 60 ) );
switch (
QMessageBox::warning( this, tr( "Continue?" ), msg, QMessageBox::Yes, QMessageBox::No )
)
{
case QMessageBox::Yes: break;
case QMessageBox::No: return;
default: return;
}
}
QString srv = settingsTab->ntpServer();
// Send information to time server tab if enabled
if ( ntpTabEnabled )
{
ntpTab->setStartTime( QDateTime::currentDateTime().toString() );
QString output = tr( "Running:\nntpdate " );
output.append( srv );
ntpTab->addNtpOutput( output );
}
if ( !ntpProcess )
{
ntpProcess = new OProcess();
connect( ntpProcess, SIGNAL(receivedStdout(OProcess*,char*,int)),
this, SLOT(slotNtpOutput(OProcess*,char*,int)) );
connect( ntpProcess, SIGNAL(processExited(OProcess*)),
this, SLOT(slotNtpFinished(OProcess*)) );
}
else
ntpProcess->clearArguments();
diff --git a/noncore/settings/netsystemtime/settingstabwidget.cpp b/noncore/settings/netsystemtime/settingstabwidget.cpp
index 2a7e28d..ad80e05 100644
--- a/noncore/settings/netsystemtime/settingstabwidget.cpp
+++ b/noncore/settings/netsystemtime/settingstabwidget.cpp
@@ -1,159 +1,159 @@
/*
                This file is part of the OPIE Project
=.
             .=l. Copyright (c) 2002 OPIE team <opie@handhelds.org?>
           .>+-=
 _;:,     .>    :=|. This file is free software; you can
.> <`_,   >  .   <= redistribute it and/or modify it under
:`=1 )Y*s>-.--   : the terms of the GNU General Public
.="- .-=="i,     .._ License as published by the Free Software
 - .   .-<_>     .<> Foundation; either version 2 of the License,
     ._= =}       : or (at your option) any later version.
    .%`+i>       _;_.
    .i_,=:_.      -<s. This file is distributed in the hope that
     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
    : ..    .:,     . . . without even the implied warranty of
    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
..}^=.=       =       ; Public License for more details.
++=   -.     .`     .:
 :     =  ...= . :.=- You should have received a copy of the GNU
 -.   .:....=;==+<; General Public License along with this file;
  -_. . .   )=.  = see the file COPYING. If not, write to the
    --        :-=` Free Software Foundation, Inc.,
59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "settingstabwidget.h"
#include <qpe/config.h>
#include <qpe/qpeapplication.h>
#include <qcheckbox.h>
#include <qcombobox.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qscrollview.h>
#include <qspinbox.h>
SettingsTabWidget::SettingsTabWidget( QWidget *parent )
: QWidget( parent, 0x0, 0 )
{
QVBoxLayout *tmpvb = new QVBoxLayout( this );
QScrollView *sv = new QScrollView( this );
tmpvb->addWidget( sv, 0, 0 );
sv->setResizePolicy( QScrollView::AutoOneFit );
sv->setFrameStyle( QFrame::NoFrame );
QWidget *container = new QWidget( sv->viewport() );
sv->addChild( container );
QGridLayout *layout = new QGridLayout( container );
layout->setMargin( 2 );
layout->setSpacing( 4 );
// Time server selector
layout->addWidget( new QLabel( tr( "Time server" ), container ), 0, 0 );
cbTimeServer = new QComboBox( TRUE, container );
layout->addMultiCellWidget( cbTimeServer, 1, 1, 0, 1 );
// Lookup delay selector
layout->addWidget( new QLabel( tr( "minutes between time updates" ), container ), 2, 1 );
sbNtpDelay = new QSpinBox( 1, 9999999, 1, container );
sbNtpDelay->setWrapping( TRUE );
sbNtpDelay->setMaximumWidth( 50 );
connect( sbNtpDelay, SIGNAL(valueChanged(int)), this, SIGNAL(ntpDelayChanged(int)) );
layout->addWidget( sbNtpDelay, 2, 0 );
// Prediction delay selector
layout->addWidget( new QLabel( tr( "minutes between prediction updates" ), container ), 3, 1 );
sbPredictDelay = new QSpinBox( 42, 9999999, 1, container );
sbPredictDelay->setWrapping( TRUE );
sbPredictDelay->setMaximumWidth( 50 );
layout->addWidget( sbPredictDelay, 3, 0 );
// Space filler
layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ), 4, 0 );
// Display time server information selector
chNtpTab = new QCheckBox( tr( "Display time server information" ), container );
- connect( chNtpTab, SIGNAL( toggled( bool ) ), this, SIGNAL( displayNTPTab( bool ) ) );
+ connect( chNtpTab, SIGNAL( toggled(bool) ), this, SIGNAL( displayNTPTab(bool) ) );
layout->addMultiCellWidget( chNtpTab, 5, 5, 0, 1 );
// Display time prediction information selector
chPredictTab = new QCheckBox( tr( "Display time prediction information" ), container );
- connect( chPredictTab, SIGNAL( toggled( bool ) ), this, SIGNAL( displayPredictTab( bool ) ) );
+ connect( chPredictTab, SIGNAL( toggled(bool) ), this, SIGNAL( displayPredictTab(bool) ) );
layout->addMultiCellWidget( chPredictTab, 6, 6, 0, 1 );
// Space filler
layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ), 7, 0 );
// Initialize values
QString ntpSrvsFile = QPEApplication::qpeDir();
ntpSrvsFile.append( "etc/ntpservers" );
Config ntpSrvs( ntpSrvsFile, Config::File );
ntpSrvs.setGroup( "servers" );
int srvCount = ntpSrvs.readNumEntry( "count", 0 );
for ( int i = 0; i < srvCount; i++ )
{
ntpSrvs.setGroup( QString::number( i ) );
cbTimeServer->insertItem( ntpSrvs.readEntry( "name" ) );
}
if ( srvCount==0 )
cbTimeServer->insertItem( "time.fu-berlin.de" );
Config config( "ntp" );
config.setGroup( "settings" );
sbPredictDelay->setValue( config.readNumEntry( "minLookupDiff", 720 ) );
sbNtpDelay->setValue( config.readNumEntry( "ntpRefreshFreq", 1440 ) );
cbTimeServer->setCurrentItem( config.readNumEntry( "ntpServer", 0 ) );
chNtpTab->setChecked( config.readBoolEntry( "displayNtpTab", FALSE ) );
chPredictTab->setChecked( config.readBoolEntry( "displayPredictTab", FALSE ) );
}
SettingsTabWidget::~SettingsTabWidget()
{
}
void SettingsTabWidget::saveSettings()
{
int srvCount = cbTimeServer->count();
bool serversChanged = TRUE;
int curSrv = cbTimeServer->currentItem();
QString edit = cbTimeServer->currentText();
for ( int i = 0; i < srvCount; i++ )
{
if ( edit == cbTimeServer->text( i ) )
serversChanged = FALSE;
}
if ( serversChanged )
{
QString ntpSrvsFile = QPEApplication::qpeDir();
ntpSrvsFile.append( "etc/ntpservers" );
Config ntpSrvs( ntpSrvsFile, Config::File );
ntpSrvs.setGroup( "servers" );
ntpSrvs.writeEntry( "count", ++srvCount );
ntpSrvs.setGroup( "0" );
ntpSrvs.writeEntry( "name", edit );
curSrv = 0;
for ( int i = 1; i < srvCount; i++ )
{
// qDebug( "ntpSrvs[%i/%i]=%s", i, srvCount, cbTimeServer->text( i ).latin1() );
ntpSrvs.setGroup( QString::number( i ) );
ntpSrvs.writeEntry( "name", cbTimeServer->text( i-1 ) );
}
}
Config config( "ntp", Config::User );
config.setGroup( "settings" );
config.writeEntry( "ntpServer", curSrv );
config.writeEntry( "minLookupDiff", sbPredictDelay->value() );
config.writeEntry( "ntpRefreshFreq", sbNtpDelay->value() );
config.writeEntry( "displayNtpTab", chNtpTab->isChecked() );
config.writeEntry( "displayPredictTab", chPredictTab->isChecked() );
}
QString SettingsTabWidget::ntpServer()
{
return cbTimeServer->currentText();
}
diff --git a/noncore/settings/netsystemtime/timetabwidget.cpp b/noncore/settings/netsystemtime/timetabwidget.cpp
index 6f24462..1ea460e 100644
--- a/noncore/settings/netsystemtime/timetabwidget.cpp
+++ b/noncore/settings/netsystemtime/timetabwidget.cpp
@@ -9,193 +9,193 @@
.="- .-=="i,     .._ License as published by the Free Software
 - .   .-<_>     .<> Foundation; either version 2 of the License,
     ._= =}       : or (at your option) any later version.
    .%`+i>       _;_.
    .i_,=:_.      -<s. This file is distributed in the hope that
     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
    : ..    .:,     . . . without even the implied warranty of
    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
..}^=.=       =       ; Public License for more details.
++=   -.     .`     .:
 :     =  ...= . :.=- You should have received a copy of the GNU
 -.   .:....=;==+<; General Public License along with this file;
  -_. . .   )=.  = see the file COPYING. If not, write to the
    --        :-=` Free Software Foundation, Inc.,
59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "timetabwidget.h"
#include <qpe/config.h>
#include <qpe/datebookmonth.h>
#include <qpe/global.h>
#include <qpe/resource.h>
#include <qpe/tzselect.h>
#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP)
#include <qpe/qcopenvelope_qws.h>
#endif
#include <qcombobox.h>
#include <qdatetime.h>
#include <qframe.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qpushbutton.h>
#include <qscrollview.h>
#include <qspinbox.h>
#include <stdlib.h>
#include <sys/time.h>
static const int ValueAM = 0;
static const int ValuePM = 1;
TimeTabWidget::TimeTabWidget( QWidget *parent )
: QWidget( parent, 0x0, 0 )
{
// Synchronize HW clock to systemtime
// This app will update systemtime
// - if Cancel is clicked, will reset systemtime to HW clock's time
// - if Ok is clicked, will leave systemtime as is
system("/sbin/hwclock --systohc --utc");
QVBoxLayout *tmpvb = new QVBoxLayout( this );
QScrollView *sv = new QScrollView( this );
tmpvb->addWidget( sv, 0, 0 );
sv->setResizePolicy( QScrollView::AutoOneFit );
sv->setFrameStyle( QFrame::NoFrame );
QWidget *container = new QWidget( sv->viewport() );
sv->addChild( container );
QGridLayout *layout = new QGridLayout( container );
layout->setMargin( 2 );
layout->setSpacing( 4 );
// Hours
layout->addMultiCellWidget( new QLabel( tr( "Hour" ), container ), 1, 1, 0, 1 );
sbHour = new QSpinBox( container );
sbHour->setWrapping( TRUE );
layout->addMultiCellWidget( sbHour, 2, 2, 0, 1 );
// Minutes
layout->addMultiCellWidget( new QLabel( tr( "Minute" ), container ), 1, 1, 2, 3 );
sbMin = new QSpinBox( container );
sbMin->setWrapping( TRUE );
sbMin->setMinValue( 0 );
sbMin->setMaxValue( 59 );
layout->addMultiCellWidget( sbMin, 2, 2, 2, 3 );
// AM/PM
cbAmpm = new QComboBox( container );
cbAmpm->insertItem( tr( "AM" ), ValueAM );
cbAmpm->insertItem( tr( "PM" ), ValuePM );
layout->addMultiCellWidget( cbAmpm, 2, 2, 4, 5 );
// Date
layout->addWidget( new QLabel( tr( "Date" ), container ), 4, 0 );
btnDate = new DateButton( TRUE, container );
layout->addMultiCellWidget( btnDate, 4, 4, 1, 5 );
// Timezone
layout->addMultiCellWidget( new QLabel( tr( "Time zone" ), container ), 6, 6, 0, 1 );
selTimeZone = new TimeZoneSelector( container );
- connect( selTimeZone, SIGNAL(signalNewTz(const QString &)), this, SLOT(slotTZChanged(const QString &)) );
+ connect( selTimeZone, SIGNAL(signalNewTz(const QString&)), this, SLOT(slotTZChanged(const QString&)) );
layout->addMultiCellWidget( selTimeZone, 6, 6, 2, 5 );
// Space filler
layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ), 7, 0 );
// Set NTP time button
QPushButton *pb = new QPushButton( Resource::loadPixmap( "netsystemtime/ntptab" ),
tr( "Get time from the network" ), container );
connect( pb, SIGNAL(clicked()), this, SIGNAL(getNTPTime()) );
layout->addMultiCellWidget( pb, 8, 8, 0, 5 );
// Set predicted time button
pb = new QPushButton( Resource::loadPixmap( "netsystemtime/predicttab" ), tr( "Set predicted time" ),
container );
connect( pb, SIGNAL(clicked()), this, SIGNAL(getPredictedTime()) );
layout->addMultiCellWidget( pb, 9, 9, 0, 5 );
// Space filler at bottom of widget
layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ), 10, 0 );
// Initialize values
Config config( "locale" );
config.setGroup( "Location" );
selTimeZone->setCurrentZone( config.readEntry( "Timezone", "America/New_York" ) );
use12HourTime = FALSE;
setDateTime( QDateTime::currentDateTime() );
}
TimeTabWidget::~TimeTabWidget()
{
}
void TimeTabWidget::saveSettings( bool commit )
{
if ( commit )
{
// Set timezone and announce to world
QString tz = selTimeZone->currentZone();
Config config("locale");
config.setGroup( "Location" );
config.writeEntry( "Timezone", tz );
setenv( "TZ", tz, 1 );
QCopEnvelope setTimeZone( "QPE/System", "timeChange(QString)" );
setTimeZone << tz;
// If controls have a valid date & time, update systemtime
int hour = sbHour->value();
if ( use12HourTime && cbAmpm->currentItem() == ValuePM )
hour += 12;
QDateTime dt( btnDate->date(), QTime ( hour, sbMin->value(), QTime::currentTime().second() ) );
setSystemTime( dt );
}
else
{
// Reset systemtime to hardware clock (i.e. undo any changes made by this app)
system("/sbin/hwclock --hctosys --utc");
}
}
void TimeTabWidget::setDateTime( const QDateTime &dt )
{
// Set time
QTime t = dt.time();
if( use12HourTime )
{
int show_hour = t.hour();
if ( t.hour() >= 12 )
{
show_hour -= 12;
cbAmpm->setCurrentItem( ValuePM );
}
else
{
cbAmpm->setCurrentItem( ValueAM );
}
if ( show_hour == 0 )
show_hour = 12;
sbHour->setValue( show_hour );
}
else
{
sbHour->setValue( t.hour() );
}
sbMin->setValue( t.minute() );
// Set date
btnDate->setDate( dt.date() );
}
void TimeTabWidget::setSystemTime( const QDateTime &dt )
{
// Set system clock
if ( dt.isValid() )
{
struct timeval myTv;
int t = TimeConversion::toUTC( dt );
diff --git a/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp b/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp
index 698dfd3..ff65424 100644
--- a/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp
+++ b/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp
@@ -1,104 +1,104 @@
#include "interfaceinformationimp.h"
#include "interfaceadvanced.h"
/* OPIE */
#include <qpe/config.h>
#include <qpe/qpeapplication.h>
/* QT */
#include <qcheckbox.h>
#include <qpushbutton.h>
#include <qlabel.h>
#include <qgroupbox.h>
#include <qmessagebox.h>
#ifdef QWS
#else
#define showMaximized show
#endif
/**
* Constructor for the InterfaceInformationImp class. This class pretty much
* just display's information about the interface that is passed to it.
*/
InterfaceInformationImp::InterfaceInformationImp(QWidget *parent, const char *name, Interface *i, WFlags f):InterfaceInformation(parent, name, f), interface(i)
{
- connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *)));
- connect(i, SIGNAL(updateMessage(const QString &)), this, SLOT(showMessage(const QString &)));
+ connect(i, SIGNAL(updateInterface(Interface*)), this, SLOT(updateInterface(Interface*)));
+ connect(i, SIGNAL(updateMessage(const QString&)), this, SLOT(showMessage(const QString&)));
updateInterface(interface);
connect(startButton, SIGNAL(clicked()), interface, SLOT(start()));
connect(stopButton, SIGNAL(clicked()), interface, SLOT(stop()));
connect(restartButton, SIGNAL(clicked()), interface, SLOT(restart()));
connect(refreshButton, SIGNAL(clicked()), interface, SLOT(refresh()));
connect(advancedButton, SIGNAL(clicked()), this, SLOT(advanced()));
Config cfg("networksettings", Config::User);
cfg.setGroup("interface");
CheckBoxSilent->setChecked( cfg.readBoolEntry("silent", false) );
}
InterfaceInformationImp::~InterfaceInformationImp()
{
Config cfg("networksettings", Config::User);
cfg.setGroup("interface");
cfg.writeEntry("silent", CheckBoxSilent->isChecked() );
}
/**
* Update the interface information and buttons.
* @param Intarface *i the interface to update (should be the one we already
* know about).
*/
void InterfaceInformationImp::updateInterface(Interface *)
{
if(interface->getStatus())
{
startButton->setEnabled(false);
stopButton->setEnabled(true);
restartButton->setEnabled(true);
}
else
{
startButton->setEnabled(true);
stopButton->setEnabled(false);
restartButton->setEnabled(false);
}
macAddressLabel->setText(interface->getMacAddress());
ipAddressLabel->setText(interface->getIp());
subnetMaskLabel->setText(interface->getSubnetMask());
broadcastLabel->setText(interface->getBroadcast());
}
/**
* Create the advanced widget. Fill it with the current interface's information.
* Display it.
*/
void InterfaceInformationImp::advanced()
{
InterfaceAdvanced *a = new InterfaceAdvanced(this, "InterfaceAdvanced", Qt::WType_Modal | Qt::WDestructiveClose | Qt::WStyle_Dialog);
a->interfaceName->setText(interface->getInterfaceName());
a->macAddressLabel->setText(interface->getMacAddress());
a->ipAddressLabel->setText(interface->getIp());
a->subnetMaskLabel->setText(interface->getSubnetMask());
a->broadcastLabel->setText(interface->getBroadcast());
a->dhcpServerLabel->setText(interface->getDhcpServerIp());
a->leaseObtainedLabel->setText(interface->getLeaseObtained());
a->leaseExpiresLabel->setText(interface->getLeaseExpires());
a->dhcpInformation->setEnabled(interface->isDhcp());
QPEApplication::showWidget( a );
}
/**
* Messages from the interface if start/stop went as planned.
* Purly for user feedback.
* @param message the message to display.
*/
void InterfaceInformationImp::showMessage(const QString &message)
{
if (CheckBoxSilent->isChecked()) return;
QMessageBox::information(this, "Message", message, QMessageBox::Ok);
}
// infoimp.cpp
diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp
index b0a1dd9..1e16b97 100644
--- a/noncore/settings/networksettings/mainwindowimp.cpp
+++ b/noncore/settings/networksettings/mainwindowimp.cpp
@@ -4,365 +4,365 @@
#include "interfaceinformationimp.h"
#include "interfacesetupimp.h"
#include "interfaces.h"
#include "module.h"
/* OPIE */
#include <qpe/qcopenvelope_qws.h>
#include <qpe/qpeapplication.h>
#include <qpe/config.h>
#include <qpe/qlibrary.h>
#include <qpe/resource.h>
/* QT */
#include <qpushbutton.h>
#include <qlistbox.h>
#include <qlineedit.h>
#include <qlistview.h>
#include <qheader.h>
#include <qlabel.h>
#include <qtabwidget.h> // in order to disable the profiles tab
#include <qmessagebox.h>
#if QT_VERSION < 300
#include <qlist.h>
#else
#include <qptrlist.h>
#endif
#include <qdir.h>
#include <qfile.h>
#include <qtextstream.h>
#include <qregexp.h>
/* STD */
#include <net/if.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#define DEFAULT_SCHEME "/var/lib/pcmcia/scheme"
#define _PROCNETDEV "/proc/net/dev"
MainWindowImp::MainWindowImp(QWidget *parent, const char *name, WFlags) : MainWindow(parent, name, Qt::WStyle_ContextHelp), advancedUserMode(true), scheme(DEFAULT_SCHEME)
{
connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked()));
connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked()));
connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked()));
connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked()));
connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile()));
connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile()));
connect(setCurrentProfileButton, SIGNAL(clicked()), this, SLOT(changeProfile()));
connect(newProfile, SIGNAL(textChanged(const QString&)), this, SLOT(newProfileChanged(const QString&)));
//FIXME: disable profiles for the moment:
tabWidget->setTabEnabled( tab, false );
// Load connections.
// /usr/local/kde/lib/libinterfaces.la
#ifdef QWS
loadModules(QPEApplication::qpeDir() + "plugins/networksettings");
#else
loader = KLibLoader::self();
loadModules(QString("/usr/")+KStandardDirs::kde_default("lib"));
#endif
getAllInterfaces();
Interfaces i;
QStringList list = i.getInterfaceList();
QMap<QString, Interface*>::Iterator it;
for ( QStringList::Iterator ni = list.begin(); ni != list.end(); ++ni )
{
/*
* we skipped it in getAllInterfaces now
* we need to ignore it as well
*/
if (m_handledIfaces.contains( *ni) )
{
qDebug("Not up iface handled by module");
continue;
}
bool found = false;
for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it )
{
if(it.key() == (*ni))
found = true;
}
if(!found)
{
if(!(*ni).contains("_"))
{
Interface *i = new Interface(this, *ni, false);
i->setAttached(false);
i->setHardwareName(tr("Disconnected"));
interfaceNames.insert(i->getInterfaceName(), i);
updateInterface(i);
- connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *)));
+ connect(i, SIGNAL(updateInterface(Interface*)), this, SLOT(updateInterface(Interface*)));
}
}
}
//getInterfaceList();
connectionList->header()->hide();
Config cfg("NetworkSetup");
profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All"));
for ( QStringList::Iterator it = profiles.begin();
it != profiles.end(); ++it)
profilesList->insertItem((*it));
currentProfileLabel->setText(cfg.readEntry("CurrentProfile", "All"));
advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false);
scheme = cfg.readEntry("SchemeFile", DEFAULT_SCHEME);
QFile file(scheme);
if ( file.open(IO_ReadOnly) )
{ // file opened successfully
QTextStream stream( &file ); // use a text stream
while ( !stream.eof() )
{ // until end of file...
QString line = stream.readLine(); // line of text excluding '\n'
if(line.contains("SCHEME"))
{
line = line.mid(7, line.length());
currentProfileLabel->setText(line);
break;
}
}
file.close();
}
makeChannel();
}
/**
* Deconstructor. Save profiles. Delete loaded libraries.
*/
MainWindowImp::~MainWindowImp()
{
// Save profiles.
Config cfg("NetworkSetup");
cfg.setGroup("General");
cfg.writeEntry("Profiles", profiles.join(" "));
// Delete all interfaces that don't have owners.
QMap<Interface*, QListViewItem*>::Iterator iIt;
for( iIt = items.begin(); iIt != items.end(); ++iIt )
{
if(iIt.key()->getModuleOwner() == NULL)
delete iIt.key();
}
#ifdef QWS
// Delete Modules and Libraries
QMap<Module*, QLibrary*>::Iterator it;
for( it = libraries.begin(); it != libraries.end(); ++it )
{
delete it.key();
// I wonder why I can't delete the libraries
// What fucking shit this is.
//delete it.data();
}
#else
// klibloader automaticly deletes the libraries for us...
#endif
}
/**
* Query the kernel for all of the interfaces.
*/
void MainWindowImp::getAllInterfaces()
{
int sockfd = socket(PF_INET, SOCK_DGRAM, 0);
if(sockfd == -1)
return;
struct ifreq ifr;
QStringList ifaces;
QFile procFile(QString(_PROCNETDEV));
int result;
Interface *i;
if (! procFile.exists())
{
struct ifreq ifrs[100];
struct ifconf ifc;
ifc.ifc_len = sizeof(ifrs);
ifc.ifc_req = ifrs;
result = ioctl(sockfd, SIOCGIFCONF, &ifc);
for (unsigned int i = 0; i < ifc.ifc_len / sizeof(struct ifreq); i++)
{
struct ifreq *pifr = &ifrs[i];
ifaces += pifr->ifr_name;
}
}
else
{
procFile.open(IO_ReadOnly);
QString line;
QTextStream procTs(&procFile);
int loc = -1;
procTs.readLine(); // eat a line
procTs.readLine(); // eat a line
while((line = procTs.readLine().simplifyWhiteSpace()) != QString::null)
{
if((loc = line.find(":")) != -1)
{
ifaces += line.left(loc);
}
}
}
for (QStringList::Iterator it = ifaces.begin(); it != ifaces.end(); ++it)
{
int flags = 0;
if ( m_handledIfaces.contains( (*it) ) )
{
qDebug(" %s is handled by a module", (*it).latin1() );
continue;
}
// int family;
i = NULL;
strcpy(ifr.ifr_name, (*it).latin1());
struct ifreq ifcopy;
ifcopy = ifr;
result = ioctl(sockfd, SIOCGIFFLAGS, &ifcopy);
flags = ifcopy.ifr_flags;
i = new Interface(this, ifr.ifr_name, false);
i->setAttached(true);
if ((flags & IFF_UP) == IFF_UP)
i->setStatus(true);
else
i->setStatus(false);
if ((flags & IFF_BROADCAST) == IFF_BROADCAST)
i->setHardwareName("Ethernet");
else if ((flags & IFF_POINTOPOINT) == IFF_POINTOPOINT)
i->setHardwareName("Point to Point");
else if ((flags & IFF_MULTICAST) == IFF_MULTICAST)
i->setHardwareName("Multicast");
else if ((flags & IFF_LOOPBACK) == IFF_LOOPBACK)
i->setHardwareName("Loopback");
else
i->setHardwareName("Unknown");
qWarning("Adding interface %s to interfaceNames\n", ifr.ifr_name);
interfaceNames.insert(i->getInterfaceName(), i);
updateInterface(i);
- connect(i, SIGNAL(updateInterface(Interface *)),
- this, SLOT(updateInterface(Interface *)));
+ connect(i, SIGNAL(updateInterface(Interface*)),
+ this, SLOT(updateInterface(Interface*)));
}
// now lets ask the plugins too ;)
QMap<Module*, QLibrary*>::Iterator it;
QList<Interface> ilist;
for( it = libraries.begin(); it != libraries.end(); ++it )
{
if(it.key())
{
ilist = it.key()->getInterfaces();
for( i = ilist.first(); i != 0; i = ilist.next() )
{
qWarning("Adding interface %s to interfaceNames\n", i->getInterfaceName().latin1() );
interfaceNames.insert(i->getInterfaceName(), i);
updateInterface(i);
- connect(i, SIGNAL(updateInterface(Interface *)),
- this, SLOT(updateInterface(Interface *)));
+ connect(i, SIGNAL(updateInterface(Interface*)),
+ this, SLOT(updateInterface(Interface*)));
}
}
}
}
/**
* Load all modules that are found in the path
* @param path a directory that is scaned for any plugins that can be loaded
* and attempts to load them
*/
void MainWindowImp::loadModules(const QString &path)
{
#ifdef DEBUG
qDebug("MainWindowImp::loadModules: %s", path.latin1());
#endif
QDir d(path);
if(!d.exists())
return;
// Don't want sym links
d.setFilter( QDir::Files | QDir::NoSymLinks );
const QFileInfoList *list = d.entryInfoList();
QFileInfoListIterator it( *list );
QFileInfo *fi;
while ( (fi=it.current()) )
{
#ifdef QWS
if(fi->fileName().contains(".so"))
{
#else
if(fi->fileName().contains(".so") && fi->fileName().contains("networksettings_"))
{
#endif
loadPlugin(path + "/" + fi->fileName());
qDebug("loaded plugin: >%s< ",QString(path + "/" + fi->fileName()).latin1());
}
++it;
}
}
/**
* Attempt to load a function and resolve a function.
* @param pluginFileName - the name of the file in which to attempt to load
* @param resolveString - function pointer to resolve
* @return pointer to the function with name resolveString or NULL
*/
Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString &resolveString)
{
#ifdef DEBUG
qDebug("MainWindowImp::loadPlugin: %s: resolving %s", pluginFileName.latin1(), resolveString.latin1());
#endif
#ifdef QWS
QLibrary *lib = new QLibrary(pluginFileName);
void *functionPointer = lib->resolve(resolveString);
if( !functionPointer )
{
#ifdef DEBUG
qDebug("MainWindowImp::loadPlugin: Warning: %s is not a plugin", pluginFileName.latin1());
#endif
delete lib;
return NULL;
}
// Try to get an object.
Module *object = ((Module* (*)()) functionPointer)();
if(object == NULL)
{
#ifdef DEBUG
qDebug("MainWindowImp: Couldn't create object, but did load library!");
#endif
delete lib;
return NULL;
}
m_handledIfaces += object->handledInterfaceNames();
// Store for deletion later
libraries.insert(object, lib);
return object;
#else
QLibrary *lib = loader->library(pluginFileName);
if( !lib || !lib->hasSymbol(resolveString) )
{
qDebug(QString("MainWindowImp::loadPlugin: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1());
return NULL;
}
// Try to get an object.
Module *object = ((Module* (*)()) lib->symbol(resolveString))();
if(object == NULL)
{
#ifdef DEBUG
qDebug("MainWindowImp: Couldn't create object, but did load library!");
#endif
return NULL;
}
#ifdef DEBUG
qDebug("MainWindowImp::loadPlugin:: Found object, storing.");
@@ -619,130 +619,130 @@ void MainWindowImp::removeProfile()
{
if(profilesList->count() <= 1)
{
QMessageBox::information(this, "Can't remove.","At least one profile\nis needed.", QMessageBox::Ok);
return;
}
QString profileToRemove = profilesList->currentText();
if(profileToRemove == "All")
{
QMessageBox::information(this, "Can't remove.","Can't remove default.", QMessageBox::Ok);
return;
}
// Can't remove the curent profile
if(profileToRemove == currentProfileLabel->text())
{
QMessageBox::information(this, "Can't remove.",QString("%1 is the current profile.").arg(profileToRemove), QMessageBox::Ok);
return;
}
if(QMessageBox::information(this, "Question",QString("Remove profile: %1").arg(profileToRemove), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok)
{
profiles = QStringList::split(" ", profiles.join(" ").replace(QRegExp(profileToRemove), ""));
profilesList->clear();
for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it)
profilesList->insertItem((*it));
// Remove any interface settings and mappings.
Interfaces interfaces;
// Go through them one by one
QMap<Interface*, QListViewItem*>::Iterator it;
for( it = items.begin(); it != items.end(); ++it )
{
QString interfaceName = it.key()->getInterfaceName();
qDebug(interfaceName.latin1());
if(interfaces.setInterface(interfaceName + "_" + profileToRemove))
{
interfaces.removeInterface();
if(interfaces.setMapping(interfaceName))
{
if(profilesList->count() == 1)
interfaces.removeMapping();
else
{
interfaces.removeMap("map", interfaceName + "_" + profileToRemove);
}
}
interfaces.write();
break;
}
}
}
}
/**
* A new profile has been selected, change.
* @param newProfile the new profile.
*/
void MainWindowImp::changeProfile()
{
if(profilesList->currentItem() == -1)
{
QMessageBox::information(this, "Can't Change.","Please select a profile.", QMessageBox::Ok);
return;
}
QString newProfile = profilesList->text(profilesList->currentItem());
if(newProfile != currentProfileLabel->text())
{
currentProfileLabel->setText(newProfile);
QFile::remove(scheme);
QFile file(scheme);
if ( file.open(IO_ReadWrite) )
{
QTextStream stream( &file );
stream << QString("SCHEME=%1").arg(newProfile);
file.close();
}
// restart all up devices?
if(QMessageBox::information(this, "Question","Restart all running interfaces?", QMessageBox::Ok, QMessageBox::No) == QMessageBox::Ok)
{
// Go through them one by one
QMap<Interface*, QListViewItem*>::Iterator it;
for( it = items.begin(); it != items.end(); ++it )
{
if(it.key()->getStatus() == true)
it.key()->restart();
}
}
}
// TODO change the profile in the modules
}
void MainWindowImp::makeChannel()
{
channel = new QCopChannel( "QPE/Application/networksettings", this );
- connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
- this, SLOT(receive(const QCString&, const QByteArray&)) );
+ connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
+ this, SLOT(receive(const QCString&,const QByteArray&)) );
}
void MainWindowImp::receive(const QCString &msg, const QByteArray &arg)
{
bool found = false;
qDebug("MainWindowImp::receive QCop msg >"+msg+"<");
if (msg == "raise")
{
raise();
return;
}
QString dest = msg.left(msg.find("("));
QCString param = msg.right(msg.length() - msg.find("(") - 1);
param = param.left( param.length() - 1 );
qDebug("dest >%s< param >"+param+"<",dest.latin1());
QMap<Module*, QLibrary*>::Iterator it;
for( it = libraries.begin(); it != libraries.end(); ++it )
{
qDebug("plugin >%s<", it.key()->type().latin1() );
if(it.key()->type() == dest)
{
it.key()->receive( param, arg );
found = true;
}
}
if (found) QPEApplication::setKeepRunning();
else qDebug("Huh what do ya want");
}
diff --git a/noncore/settings/networksettings/ppp/edit.cpp b/noncore/settings/networksettings/ppp/edit.cpp
index 7d21605..3b2393c 100644
--- a/noncore/settings/networksettings/ppp/edit.cpp
+++ b/noncore/settings/networksettings/ppp/edit.cpp
@@ -479,194 +479,194 @@ void IPWidget::autoname_t(bool on)
"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::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)
{
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 &)));
+ 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_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);
@@ -1091,121 +1091,121 @@ void ScriptWidget::insertButton()
break;
case ScriptEdit::Timeout:
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;
case ScriptEdit::ID:
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;
case ScriptEdit::PWPrompt:
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;
case ScriptEdit::LoopEnd:
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;
case ScriptEdit::Save:
stl->insertItem("Save", stl->currentItem());
sl->insertItem(se->text(), sl->currentItem());
break;
default:
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);
}
}
/////////////////////////////////////////////////////////////////////////////
//
// Used to specify a new phone number
//
/////////////////////////////////////////////////////////////////////////////
PhoneNumberDialog::PhoneNumberDialog(QWidget *parent)
: QDialog(parent,"PhoneNumberDialog",true)
{
setCaption( tr("Add Phone Number") );
QVBoxLayout *layout = new QVBoxLayout( this );
layout->setSpacing( 3 );
layout->setMargin( 3 );
// QHBox *hbox = new QHBox(this);
// setMainWidget(hbox);
// hbox->setSpacing( 2 );//KDialog::spacingHint());
QLabel *label = new QLabel(this, tr("Enter a phone number:"));
layout->addWidget( label );
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("");
}
QString PhoneNumberDialog::phoneNumber()
{
QString s = le->text();
return s;
}
void PhoneNumberDialog::textChanged(const QString &s)
{
// enableButtonOK(s.length() > 0);
}
//#include "edit.moc"
diff --git a/noncore/settings/networksettings/ppp/general.cpp b/noncore/settings/networksettings/ppp/general.cpp
index ff1b11b..81dab38 100644
--- a/noncore/settings/networksettings/ppp/general.cpp
+++ b/noncore/settings/networksettings/ppp/general.cpp
@@ -1,184 +1,184 @@
/*
* kPPP: A pppd front end for the KDE project
*
* $Id$
*
* Copyright (C) 1997 Bernd Johannes Wuebben
* wuebben@math.cornell.edu
*
* based on EzPPP:
* Copyright (C) 1997 Jay Painter
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "general.h"
#include "interfaceppp.h"
#include "modeminfo.h"
#include "modemcmds.h"
#include "pppdata.h"
/* OPIE */
#include <qpe/config.h>
#include <qpe/qpeapplication.h>
/* QT */
#include <qcheckbox.h>
#include <qcombobox.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qpushbutton.h>
#include <qslider.h>
#include <qspinbox.h>
#include <qwhatsthis.h>
/* STD */
#include <termios.h>
#include <string.h>
ModemWidget::ModemWidget( PPPData *pd, QWidget *parent, const char *name )
: QWidget(parent, name), _pppdata(pd)
{
int k;
QGridLayout *tl = new QGridLayout(this, 8, 2, 0 );//, KDialog::spacingHint());
QLabel *label1;
label1 = new QLabel(tr("Modem &name:"), this);
tl->addWidget(label1, 0, 0);
modemname = new QLineEdit(this, "modemName");
modemname->setText( _pppdata->devname() );
label1->setBuddy(modemname);
tl->addWidget(modemname, 0, 1);
label1 = new QLabel(tr("Modem de&vice:"), this);
tl->addWidget(label1, 1, 0);
modemdevice = new QComboBox(false, this);
modemdevice->setEditable( true );
modemdevice->setDuplicatesEnabled ( false );
modemdevice->setInsertionPolicy( QComboBox::AtTop );
label1->setBuddy(modemdevice);
Config cfg("NetworkSetupPPP");
cfg.setGroup("Devices_General");
QStringList devs = cfg.readListEntry("devices",',');
if (devs.isEmpty()) devs << "/dev/modem" << "/dev/ircomm0" << "/dev/ttyS0";
modemdevice->insertStringList( devs );
tl->addWidget(modemdevice, 1, 1);
// connect(modemdevice, SIGNAL(activated(int)),
// SLOT(setmodemdc(int)));
- // connect(modemdevice, SIGNAL(textChanged( const QString & ) ),
- // SLOT( setmodemdc( const QString &) ) );
+ // connect(modemdevice, SIGNAL(textChanged(const QString&) ),
+ // SLOT( setmodemdc(const QString&) ) );
QString tmp = tr("This specifies the serial port your modem is attached \n"
"to. On Linux/x86, typically this is either /dev/ttyS0 \n"
"(COM1 under DOS) or /dev/ttyS1 (COM2 under DOS).\n"
"\n"
"If you have an internal ISDN card with AT command\n"
"emulation (most cards under Linux support this), you\n"
"should select one of the /dev/ttyIx devices.");
QWhatsThis::add(label1,tmp);
QWhatsThis::add(modemdevice,tmp);
label1 = new QLabel(tr("&Flow control:"), this);
tl->addWidget(label1, 2, 0);
flowcontrol = new QComboBox(false, this);
label1->setBuddy(flowcontrol);
flowcontrol->insertItem(tr("Hardware [CRTSCTS]"));
flowcontrol->insertItem(tr("Software [XON/XOFF]"));
flowcontrol->insertItem(tr("None"));
tl->addWidget(flowcontrol, 2, 1);
// connect(flowcontrol, SIGNAL(activated(int)),
// SLOT(setflowcontrol(int)));
tmp = tr("<p>Specifies how the serial port and modem\n"
"communicate. You should not change this unless\n"
"you know what you are doing.\n"
"\n"
"<b>Default</b>: CRTSCTS");
QWhatsThis::add(label1,tmp);
QWhatsThis::add(flowcontrol,tmp);
QLabel *labelenter = new QLabel(tr("&Line termination:"), this);
tl->addWidget(labelenter, 3, 0);
enter = new QComboBox(false, this);
labelenter->setBuddy(enter);
enter->insertItem("CR");
enter->insertItem("LF");
enter->insertItem("CR/LF");
tl->addWidget(enter, 3, 1);
// connect(enter, SIGNAL(activated(int)), SLOT(setenter(int)));
tmp = tr("<p>Specifies how AT commands are sent to your\n"
"modem. Most modems will work fine with the\n"
"default <i>CR/LF</i>. If your modem does not react\n"
"to the init string, you should try different\n"
"settings here\n"
"\n"
"<b>Default</b>: CR/LF");
QWhatsThis::add(labelenter,tmp);
QWhatsThis::add(enter, tmp);
QLabel *baud_label = new QLabel(tr("Co&nnection speed:"), this);
tl->addWidget(baud_label, 4, 0);
baud_c = new QComboBox(this);
baud_label->setBuddy(baud_c);
static const char *baudrates[] =
{
#ifdef B460800
"460800",
#endif
#ifdef B230400
"230400",
#endif
#ifdef B115200
"115200",
#endif
#ifdef B57600
"57600",
#endif
"38400",
"19200",
"9600",
"2400",
0
};
for(k = 0; baudrates[k]; k++)
baud_c->insertItem(baudrates[k]);
baud_c->setCurrentItem(3);
// connect(baud_c, SIGNAL(activated(int)),
// this, SLOT(speed_selection(int)));
tl->addWidget(baud_c, 4, 1);
tmp = tr("Specifies the speed your modem and the serial\n"
"port talk to each other. You should begin with\n"
diff --git a/noncore/settings/networksettings/ppp/kpppwidget.cpp b/noncore/settings/networksettings/ppp/kpppwidget.cpp
index e466358..e21bbc7 100644
--- a/noncore/settings/networksettings/ppp/kpppwidget.cpp
+++ b/noncore/settings/networksettings/ppp/kpppwidget.cpp
@@ -303,197 +303,197 @@ KPPPWidget::~KPPPWidget()
// bool KPPPWidget::eventFilter(QObject *o, QEvent *e) {
// if(e->type() == QEvent::User) {
// switch(((SignalEvent*)e)->sigType()) {
// case SIGINT:
// qDebug( "Received a SIGINT" );
// interruptConnection();
// break;
// case SIGCHLD:
// sigChld();
// break;
// case SIGUSR1:
// sigPPPDDied();
// break;
// }
// return true;
// }
// if(o == connect_b) {
// if(e->type() == QEvent::KeyPress) {
// if(connect_b->hasFocus() && ((QKeyEvent *)e)->key() == Qt::Key_Return) {
// beginConnect();
// return true;
// }
// }
// }
// return false;
// }
void KPPPWidget::enterPressedInID() {
PW_Edit->setFocus();
}
void KPPPWidget::enterPressedInPW() {
connect_b->setFocus();
}
// triggered by the session manager
void KPPPWidget::saveMyself() {
_pppdata->save();
}
void KPPPWidget::shutDown() {
interruptConnection();
saveMyself();
}
void KPPPWidget::log_window_toggled(bool on) {
_pppdata->set_show_log_window(on);
}
// void KPPPWidget::resetaccounts() {
// connectto_c->clear();
// int count = _pppdata->count();
// // enable/disable controls
// connectto_c->setEnabled(count > 0);
// connect_b->setEnabled(count > 0);
// log->setEnabled(count > 0);
// ID_Edit->setEnabled(count > 0);
// PW_Edit->setEnabled(count > 0);
// //load the accounts
// for(int i=0; i < count; i++) {
// _pppdata->setAccountbyIndex(i);
// connectto_c->insertItem(_pppdata->accname());
// }
// //set the default account
// if(!_pppdata->defaultAccount().isEmpty()) {
// for(int i=0; i < count; i++)
// if(_pppdata->defaultAccount() == connectto_c->text(i)) {
// connectto_c->setCurrentItem(i);
// _pppdata->setAccountbyIndex(i);
// ID_Edit->setText(_pppdata->storedUsername());
// PW_Edit->setText(_pppdata->storedPassword());
// }
// }
// else
// if(count > 0) {
// _pppdata->setDefaultAccount(connectto_c->text(0));
// _pppdata->save();
// ID_Edit->setText(_pppdata->storedUsername());
// PW_Edit->setText(_pppdata->storedPassword());
// }
-// connect(ID_Edit, SIGNAL(textChanged(const QString &)),
-// this, SLOT(usernameChanged(const QString &)));
+// connect(ID_Edit, SIGNAL(textChanged(const QString&)),
+// this, SLOT(usernameChanged(const QString&)));
-// connect(PW_Edit, SIGNAL(textChanged(const QString &)),
-// this, SLOT(passwordChanged(const QString &)));
+// connect(PW_Edit, SIGNAL(textChanged(const QString&)),
+// this, SLOT(passwordChanged(const QString&)));
// if (ID_Edit->text().isEmpty())
// ID_Edit->setFocus();
// else if (PW_Edit->text().isEmpty())
// PW_Edit->setFocus();
// }
void KPPPWidget::interruptConnection() {
// interrupt dial up
//
if (con->isVisible())
emit con->cancelbutton();
// disconnect if online
if (_pppdata->pppdRunning())
emit disconnect();
}
void KPPPWidget::sigPPPDDied() {
qDebug( "Received a SIGUSR1" );
// if we are not connected pppdpid is -1 so have have to check for that
// in the followin line to make sure that we don't raise a false alarm
// such as would be the case when the log file viewer exits.
if(_pppdata->pppdRunning() || _pppdata->pppdError()) {
qDebug( "It was pppd that died" );
// when we killpppd() on Cancel in ConnectWidget
// we set pppid to -1 so we won't
// enter this block
// just to be sure
Modem::modem->removeSecret(AUTH_PAP);
Modem::modem->removeSecret(AUTH_CHAP);
_pppdata->setpppdRunning(false);
qDebug( "Executing command on disconnect since pppd has died." );
QApplication::flushX();
execute_command(_pppdata->command_on_disconnect());
// stopAccounting();
con_win->stopClock();
// DockWidget::dock_widget->stop_stats();
// DockWidget::dock_widget->hide();
if(!_pppdata->pppdError())
_pppdata->setpppdError(E_PPPD_DIED);
removedns();
Modem::modem->unlockdevice();
//
con->pppdDied();
if(!_pppdata->automatic_redial()) {
quit_b->setFocus();
show();
con_win->stopClock();
// stopAccounting();
con_win->hide();
con->hide();
_pppdata->setpppdRunning(false);
// // not in a signal handler !!! KNotifyClient::beep();
QString msg;
if (_pppdata->pppdError() == E_IF_TIMEOUT)
msg = QObject::tr("Timeout expired while waiting for the PPP interface "
"to come up!");
else {
msg = QObject::tr("<p>The pppd daemon died unexpectedly!</p>");
Modem::modem->pppdExitStatus();
if (Modem::modem->lastStatus != 99) { // more recent pppds only
msg += QObject::tr("<p>Exit status: %1").arg(Modem::modem->lastStatus);
msg += QObject::tr("</p><p>See 'man pppd' for an explanation of the error "
"codes or take a look at the kppp FAQ on "
" <a href=http://devel-home.kde.org/~kppp/index.html>"
"http://devel-home.kde.org/~kppp/index.html</a></p>");
}
}
// if(QMessageBox::warning(0, msg, QObject::tr("Error"), QObject::tr("&OK"), QObject::tr("&Details...")) == QMessageBox::No)
// // PPPL_ShowLog();
// } else { /* reconnect on disconnect */
if (false){
qDebug( "Trying to reconnect... " );
if(_pppdata->authMethod() == AUTH_PAP ||
_pppdata->authMethod() == AUTH_CHAP ||
_pppdata->authMethod() == AUTH_PAPCHAP)
Modem::modem->setSecret(_pppdata->authMethod(),
encodeWord(_pppdata->storedUsername()),
encodeWord(_pppdata->password()));
@@ -628,194 +628,194 @@ void KPPPWidget::disconnect() {
con->setCaption(QObject::tr("Disconnecting..."));
con->setMsg(QObject::tr("Executing command before disconnection."));
qApp->processEvents();
QApplication::flushX();
// pid_t id =
execute_command(_pppdata->command_before_disconnect());
// int i, status;
// do {
// kapp->processEvents();
// i = waitpid(id, &status, WNOHANG);
// usleep(500000);
// } while (i == 0 && errno == 0);
con->hide();
}
qApp->processEvents();
// statdlg->stop_stats();
Modem::modem->killPPPDaemon();
QApplication::flushX();
execute_command(_pppdata->command_on_disconnect());
Modem::modem->removeSecret(AUTH_PAP);
Modem::modem->removeSecret(AUTH_CHAP);
removedns();
Modem::modem->unlockdevice();
con_win->stopClock();
// p_kppp->stopAccounting();
con_win->hide();
// DockWidget::dock_widget->stop_stats();
// DockWidget::dock_widget->hide();
// if(m_bQuitOnDisconnect)
// kapp->exit(0);
// else {
this->quit_b->setFocus();
this->show();
// }
}
// void KPPPWidget::helpbutton() {
// kapp->invokeHelp();
// }
void KPPPWidget::quitbutton() {
if(_pppdata->pppdRunning()) {
int ok = QMessageBox::warning(this,
QObject::tr("Exiting kPPP will close your PPP Session."),
QObject::tr("Quit kPPP?"));
if(ok == QMessageBox::Yes) {
Modem::modem->killPPPDaemon();
QApplication::flushX();
execute_command(_pppdata->command_on_disconnect());
removedns();
Modem::modem->unlockdevice();
}
} else {
if (!_pppdata->accname().isEmpty() && !_pppdata->storePassword())
_pppdata->setStoredPassword("");
}
_pppdata->save();
qApp->quit();
}
// void KPPPWidget::rulesetLoadError() {
// QMessageBox::warning(this,"error", ruleset_load_errmsg);
// }
// void KPPPWidget::startAccounting() {
// // volume accounting
// stats->totalbytes = 0;
// kdDebug() << "AcctEnabled: " << _pppdata->AcctEnabled() << endl;
// // load the ruleset
// if(!_pppdata->AcctEnabled())
// return;
// QString d = AccountingBase::getAccountingFile(_pppdata->accountingFile());
// // if(::access(d.data(), X_OK) != 0)
// acct = new Accounting(this, stats);
// // else
// // acct = new ExecutableAccounting(this);
// // connect to the accounting object
-// connect(acct, SIGNAL(changed(QString, QString)),
-// con_win, SLOT(slotAccounting(QString, QString)));
+// connect(acct, SIGNAL(changed(QString,QString)),
+// con_win, SLOT(slotAccounting(QString,QString)));
// // if(!acct->loadRuleSet(_pppdata->accountingFile())) {
// // QString s= QObject::tr("Can not load the accounting "
// // "ruleset \"%1\"!").arg(_pppdata->accountingFile());
// // starting the messagebox with a timer will prevent us
// // from blocking the calling function ConnectWidget::timerEvent
// ruleset_load_errmsg = s;
// QTimer::singleShot(0, this, SLOT(rulesetLoadError()));
// return;
// }
// //else
// // acct->slotStart();
// }
// void KPPPWidget::stopAccounting() {
// // store volume accounting
// // if(stats->totalbytes != 0)
// // _pppdata->setTotalBytes(stats->totalbytes);
// if(!_pppdata->AcctEnabled())
// return;
// // if(acct != 0) {
// // acct->slotStop();
// // delete acct;
// // acct = 0;
// // }
// }
// void KPPPWidget::showStats() {
// if(statdlg) {
// statdlg->show();
// statdlg->raise();
// }
// }
void KPPPWidget::usernameChanged(const QString &) {
// store username for later use
_pppdata->setStoredUsername(ID_Edit->text());
}
void KPPPWidget::passwordChanged(const QString &) {
// store the password if so requested
if(_pppdata->storePassword())
_pppdata->setStoredPassword(PW_Edit->text());
else
_pppdata->setStoredPassword("");
}
void KPPPWidget::setPW_Edit(const QString &pw) {
PW_Edit->setText(pw);
}
// void KPPPWidget::resetCosts(const QString &s) {
// AccountingBase::resetCosts(s);
// }
// void KPPPWidget::resetVolume(const QString &s) {
// AccountingBase::resetVolume(s);
// }
/**
* pppd's getword() function knows about escape characters.
* If we write the username and password to the secrets file
* we'll therefore have to escape back slashes.
*/
QString KPPPWidget::encodeWord(const QString &s) {
QString r = s;
r.replace(QRegExp("\\"), "\\\\");
return r;
}
// void KPPPWidget::setQuitOnDisconnect (bool b)
// {
// m_bQuitOnDisconnect = b;
// }
void KPPPWidget::showNews() {
#ifdef KPPP_SHOW_NEWS
/*
* Introduce the QuickHelp feature to new users of this version
*/
#define QUICKHELP_HINT "Hint_QuickHelp"
if(_pppdata->readNumConfig(GENERAL_GRP, QUICKHELP_HINT, 0) == 0) {
QDialog dlg(0, 0, true);
dlg.setCaption(QObject::tr("Recent Changes in KPPP"));
QVBoxLayout *tl = new QVBoxLayout(&dlg, 10, 10);
QHBoxLayout *l1 = new QHBoxLayout(10);
diff --git a/noncore/settings/networksettings/ppp/pppdargs.cpp b/noncore/settings/networksettings/ppp/pppdargs.cpp
index 66a4d82..d6d8d88 100644
--- a/noncore/settings/networksettings/ppp/pppdargs.cpp
+++ b/noncore/settings/networksettings/ppp/pppdargs.cpp
@@ -1,151 +1,151 @@
/*
* kPPP: A pppd front end for the KDE project
*
* $Id$
*
* Copyright (C) 1997 Bernd Johannes Wuebben
* wuebben@math.cornell.edu
*
* based on EzPPP:
* Copyright (C) 1997 Jay Painter
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <qlayout.h>
#include <qbuttongroup.h>
#include <qapplication.h>
#include "pppdargs.h"
#include "pppdata.h"
PPPdArguments::PPPdArguments( PPPData *pd, QWidget *parent, const char *name)
: QDialog(parent, name, TRUE), _pppdata(pd)
{
setCaption(tr("Customize pppd Arguments"));
// KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon());
QVBoxLayout *l = new QVBoxLayout(this, 10, 10);
QHBoxLayout *tl = new QHBoxLayout(10);
l->addLayout(tl);
QVBoxLayout *l1 = new QVBoxLayout();
QVBoxLayout *l2 = new QVBoxLayout();
tl->addLayout(l1, 1);
tl->addLayout(l2, 0);
QHBoxLayout *l11 = new QHBoxLayout(10);
l1->addLayout(l11);
argument_label = new QLabel(tr("Argument:"), this);
l11->addWidget(argument_label);
argument = new QLineEdit(this);
connect(argument, SIGNAL(returnPressed()),
SLOT(addbutton()));
l11->addWidget(argument);
- connect(argument, SIGNAL(textChanged(const QString &)),
- this, SLOT(textChanged(const QString &)));
+ connect(argument, SIGNAL(textChanged(const QString&)),
+ this, SLOT(textChanged(const QString&)));
arguments = new QListBox(this);
arguments->setMinimumSize(1, fontMetrics().lineSpacing()*10);
connect(arguments, SIGNAL(highlighted(int)),
this, SLOT(itemSelected(int)));
l1->addWidget(arguments, 1);
add = new QPushButton(tr("Add"), this);
connect(add, SIGNAL(clicked()), SLOT(addbutton()));
l2->addWidget(add);
l2->addStretch(1);
remove = new QPushButton(tr("Remove"), this);
connect(remove, SIGNAL(clicked()), SLOT(removebutton()));
l2->addWidget(remove);
defaults = new QPushButton(tr("Defaults"), this);
connect(defaults, SIGNAL(clicked()), SLOT(defaultsbutton()));
l2->addWidget(defaults);
l->addSpacing(5);
//load info from gpppdata
init();
add->setEnabled(false);
remove->setEnabled(false);
argument->setFocus();
}
void PPPdArguments::addbutton() {
if(!argument->text().isEmpty() && arguments->count() < MAX_PPPD_ARGUMENTS) {
arguments->insertItem(argument->text());
argument->setText("");
}
}
void PPPdArguments::removebutton() {
if(arguments->currentItem() >= 0)
arguments->removeItem(arguments->currentItem());
}
void PPPdArguments::defaultsbutton() {
// all of this is a hack
// save current list
QStringList arglist(_pppdata->pppdArgument());
// get defaults
_pppdata->setpppdArgumentDefaults();
init();
// restore old list
_pppdata->setpppdArgument(arglist);
}
void PPPdArguments::accept() {
QStringList arglist;
for(uint i=0; i < arguments->count(); i++)
arglist.append(arguments->text(i));
_pppdata->setpppdArgument(arglist);
QDialog::accept();
}
void PPPdArguments::init() {
while(arguments->count())
arguments->removeItem(0);
QStringList &arglist = _pppdata->pppdArgument();
for ( QStringList::Iterator it = arglist.begin();
it != arglist.end();
++it )
arguments->insertItem(*it);
}
void PPPdArguments::textChanged(const QString &s) {
add->setEnabled(s.length() > 0);
}
void PPPdArguments::itemSelected(int idx) {
remove->setEnabled(idx != -1);
}
diff --git a/noncore/settings/networksettings/wlan/wlanimp2.cpp b/noncore/settings/networksettings/wlan/wlanimp2.cpp
index 92339d6..dd1db28 100644
--- a/noncore/settings/networksettings/wlan/wlanimp2.cpp
+++ b/noncore/settings/networksettings/wlan/wlanimp2.cpp
@@ -1,153 +1,153 @@
#include "wlanimp2.h"
#include "keyedit.h"
#include "interfacesetupimp.h"
#include "../interfaces/interface.h"
#include <assert.h>
#include <errno.h>
#include <string.h>
#include <qapplication.h>
#include <qfile.h>
#include <qdir.h>
#include <qdialog.h>
#include <qtextstream.h>
#include <qmessagebox.h>
#include <qlineedit.h>
#include <qlabel.h>
#include <qspinbox.h>
#include <qradiobutton.h>
#include <qpushbutton.h>
#include <qcheckbox.h>
#include <qtabwidget.h>
#include <qcombobox.h>
#include <qlistview.h>
#include <qvbox.h>
#include <qprogressbar.h>
#ifdef QWS
#include <qpe/resource.h>
#include <opie2/oprocess.h>
#include <opie2/onetwork.h>
#include <opie2/opcap.h>
#else
#define OProcess KProcess
#include <kprocess.h>
#endif
#define WIRELESS_OPTS "/etc/pcmcia/wireless.opts"
#define PREUP "/etc/network/if-pre-up.d/wireless-tools"
/**
* Constructor, read in the wireless.opts file for parsing later.
*/
WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl) : WLAN(parent, name, modal, fl), interface(i), currentProfile("*") {
interfaces = new Interfaces();
interfaceSetup = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i, interfaces);
tabWidget->insertTab(interfaceSetup, "TCP/IP");
// Check sanity - the existance of the wireless-tools if-pre-up script
QFile file(QString(PREUP));
if (file.exists()) {
qWarning(QString("WLANImp: Unable to open /etc/network/if-pre-up.d/wireless-tools"));
}
connect( rescanButton, SIGNAL( clicked() ), this, SLOT( rescanNeighbourhood() ) );
- connect( netView, SIGNAL( clicked( QListViewItem* ) ), this, SLOT( selectNetwork( QListViewItem* ) ) );
+ connect( netView, SIGNAL( clicked(QListViewItem*) ), this, SLOT( selectNetwork(QListViewItem*) ) );
netView->setColumnAlignment( col_chn, AlignCenter );
netView->setItemMargin( 3 );
netView->setAllColumnsShowFocus( true );
}
WLANImp::~WLANImp() {
//FIXME: delete interfaces;
}
/**
* Change the profile for both wireless settings and network settings.
*/
void WLANImp::setProfile(const QString &profile){
interfaceSetup->setProfile(profile);
parseOpts();
}
void WLANImp::parseOpts() {
bool error;
QString opt;
if (! interfaces->isInterfaceSet())
return;
opt = interfaces->getInterfaceOption("wireless_essid", error);
if(opt == "any" || opt == "off" || opt.isNull()){
essid->setEditText("any");
} else {
essid->setEditText(opt);
}
opt = interfaces->getInterfaceOption("wireless_mode", error).simplifyWhiteSpace();
for ( int i = 0; i < mode->count(); i++)
if ( mode->text( i ) == opt ) mode->setCurrentItem( i );
opt = interfaces->getInterfaceOption("wireless_ap", error).simplifyWhiteSpace();
if (! opt.isNull()) {
specifyAp->setChecked(true);
macEdit->setText(opt);
}
opt = interfaces->getInterfaceOption("wireless_channel", error).simplifyWhiteSpace();
if (! opt.isNull()) {
specifyChan->setChecked(true);
networkChannel->setValue(opt.toInt());
}
opt = interfaces->getInterfaceOption("wireless_key", error).simplifyWhiteSpace();
if (opt.isNull())
opt = interfaces->getInterfaceOption("wireless_enc", error).simplifyWhiteSpace();
parseKeyStr(opt);
}
void WLANImp::parseKeyStr(QString keystr) {
int loc = 0;
int index = 1;
QString key;
QStringList keys = QStringList::split(QRegExp("\\s+"), keystr);
int enc = -1; // encryption state
for (QStringList::Iterator it = keys.begin(); it != keys.end(); ++it) {
if ((*it).left(3) == "off") {
// encryption disabled
enc = 0;
} else if ((*it).left(2) == "on") {
// encryption enabled
enc = 1;
} else if ((*it).left(4) == "open") {
// open mode, accept non encrypted packets
acceptNonEnc->setChecked(true);
} else if ((*it).left(10) == "restricted") {
// restricted mode, only accept encrypted packets
rejectNonEnc->setChecked(true);
} else if ((*it).left(3) == "key") {
// new set of options
} else if ((*it).left(1) == "[") {
index = (*it).mid(1, 1).toInt();
// switch current key to index
switch (index) {
case 1:
keyRadio0->setChecked(true);
break;
case 2:
keyRadio1->setChecked(true);
break;
case 3:
keyRadio2->setChecked(true);
break;
case 4:
keyRadio3->setChecked(true);
break;
}
} else {
diff --git a/noncore/settings/packagemanager/filterdlg.cpp b/noncore/settings/packagemanager/filterdlg.cpp
index 0da9d19..eeed398 100644
--- a/noncore/settings/packagemanager/filterdlg.cpp
+++ b/noncore/settings/packagemanager/filterdlg.cpp
@@ -1,167 +1,167 @@
/*
                This file is part of the OPIE Project
=. Copyright (c) 2003 Dan Williams <drw@handhelds.org>
             .=l.
           .>+-=
 _;:,     .>    :=|. This file is free software; you can
.> <`_,   >  .   <= redistribute it and/or modify it under
:`=1 )Y*s>-.--   : the terms of the GNU General Public
.="- .-=="i,     .._ License as published by the Free Software
 - .   .-<_>     .<> Foundation; either version 2 of the License,
     ._= =}       : or (at your option) any later version.
    .%`+i>       _;_.
    .i_,=:_.      -<s. This file is distributed in the hope that
     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
    : ..    .:,     . . . without even the implied warranty of
    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
..}^=.=       =       ; Public License for more details.
++=   -.     .`     .:
 :     =  ...= . :.=- You should have received a copy of the GNU
 -.   .:....=;==+<; General Public License along with this file;
  -_. . .   )=.  = see the file COPYING. If not, write to the
    --        :-=` Free Software Foundation, Inc.,
59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "filterdlg.h"
FilterDlg::FilterDlg( QWidget *parent, OPackageManager *pm, const QString &name,
const QString &server, const QString &destination,
OPackageManager::Status status, const QString &category )
: QDialog( parent, QString::null, true )
{
setCaption( tr( "Filter packages" ) );
QVBoxLayout *layout = new QVBoxLayout( this );
QScrollView *sv = new QScrollView( this );
layout->addWidget( sv, 0, 0 );
sv->setResizePolicy( QScrollView::AutoOneFit );
sv->setFrameStyle( QFrame::NoFrame );
QWidget *container = new QWidget( sv->viewport() );
sv->addChild( container );
layout = new QVBoxLayout( container, 4, 4 );
// Category
m_categoryCB = new QCheckBox( tr( "Category:" ), container );
connect( m_categoryCB, SIGNAL(toggled(bool)), this, SLOT(slotCategorySelected(bool)) );
m_category = new QComboBox( container );
m_category->insertStringList( pm->categories() );
initItem( m_category, m_categoryCB, category );
layout->addWidget( m_categoryCB );
layout->addWidget( m_category );
// Package name
m_nameCB = new QCheckBox( tr( "Names containing:" ), container );
connect( m_nameCB, SIGNAL(toggled(bool)), this, SLOT(slotNameSelected(bool)) );
m_name = new QLineEdit( name, container );
if ( !name.isNull() )
m_nameCB->setChecked( true );
m_name->setEnabled( !name.isNull() );
layout->addWidget( m_nameCB );
layout->addWidget( m_name );
// Status
m_statusCB = new QCheckBox( tr( "With the status:" ), container );
connect( m_statusCB, SIGNAL(toggled(bool)), this, SLOT(slotStatusSelected(bool)) );
m_status = new QComboBox( container );
- connect( m_status, SIGNAL(activated(const QString &)), this, SLOT(slotStatusChanged(const QString &)) );
+ connect( m_status, SIGNAL(activated(const QString&)), this, SLOT(slotStatusChanged(const QString&)) );
QString currStatus;
switch ( status )
{
case OPackageManager::All : currStatus = tr( "All" );
break;
case OPackageManager::Installed : currStatus = tr( "Installed" );
break;
case OPackageManager::NotInstalled : currStatus = tr( "Not installed" );
break;
case OPackageManager::Updated : currStatus = tr( "Updated" );
break;
default : currStatus = QString::null;
};
m_status->insertItem( tr( "All" ) );
m_status->insertItem( tr( "Installed" ) );
m_status->insertItem( tr( "Not installed" ) );
m_status->insertItem( tr( "Updated" ) );
initItem( m_status, m_statusCB, currStatus );
layout->addWidget( m_statusCB );
layout->addWidget( m_status );
// Server
m_serverCB = new QCheckBox( tr( "Available from the following server:" ), container );
connect( m_serverCB, SIGNAL(toggled(bool)), this, SLOT(slotServerSelected(bool)) );
m_server = new QComboBox( container );
m_server->insertStringList( *(pm->servers()) );
initItem( m_server, m_serverCB, server );
layout->addWidget( m_serverCB );
layout->addWidget( m_server );
// Destination
m_destCB = new QCheckBox( tr( "Installed on device at:" ), container );
connect( m_destCB, SIGNAL(toggled(bool)), this, SLOT(slotDestSelected(bool)) );
m_destination = new QComboBox( container );
m_destination->insertStringList( *(pm->destinations()) );
initItem( m_destination, m_destCB, destination );
layout->addWidget( m_destCB );
layout->addWidget( m_destination );
//showMaximized();
}
void FilterDlg::initItem( QComboBox *comboBox, QCheckBox *checkBox, const QString &selection )
{
if ( !selection.isNull() )
{
checkBox->setChecked( true );
for ( int i = 0; i < comboBox->count(); i++ )
{
if ( comboBox->text( i ) == selection )
{
comboBox->setCurrentItem( i );
return;
}
}
}
comboBox->setEnabled( !selection.isNull() );
}
void FilterDlg::slotNameSelected( bool selected )
{
m_name->setEnabled( selected );
}
void FilterDlg::slotServerSelected( bool selected )
{
m_server->setEnabled( selected );
}
void FilterDlg::slotDestSelected( bool selected )
{
m_destination->setEnabled( selected );
}
void FilterDlg::slotStatusSelected( bool selected )
{
m_status->setEnabled( selected );
if ( !selected && !m_destCB->isEnabled() )
{
// If status check box has been deselected and destination option was previously deselected
// (because status == "Not installed"), re-enable destination option
m_destCB->setEnabled( true );
m_destination->setEnabled( true );
}
else if ( selected && m_destCB->isEnabled() && m_status->currentText() == tr( "Not installed" ) )
{
// If status check box has been selected and status == "Not installed", disable destination option
m_destCB->setEnabled( false );
m_destCB->setChecked( false );
m_destination->setEnabled( false );
}
}
void FilterDlg::slotStatusChanged( const QString &category )
diff --git a/noncore/settings/packagemanager/mainwindow.cpp b/noncore/settings/packagemanager/mainwindow.cpp
index 8fd960f..b334bca 100644
--- a/noncore/settings/packagemanager/mainwindow.cpp
+++ b/noncore/settings/packagemanager/mainwindow.cpp
@@ -25,226 +25,226 @@
59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <qaction.h>
#include <qdir.h>
#include <qlayout.h>
#include <qlineedit.h>
#include <qmenubar.h>
#include <qmessagebox.h>
#include <qpopupmenu.h>
#include <qtimer.h>
#include <qtoolbar.h>
#include <qwhatsthis.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/qpeapplication.h>
#include <qpe/resource.h>
#include "mainwindow.h"
#include "installdlg.h"
#include "filterdlg.h"
#include "promptdlg.h"
#include "entrydlg.h"
#include "packageinfodlg.h"
MainWindow::MainWindow( QWidget *parent, const char *name, WFlags /*fl*/ )
: QMainWindow( parent, name, WStyle_ContextHelp )
, m_config( "packman" )
, m_packman( &m_config, this )
, m_menuBar( this )
, m_toolBar( this )
, m_findBar( this )
, m_widgetStack( this )
, m_packageList( this )
, m_statusWidget( this )
, m_statusText( &m_statusWidget )
, m_statusBar( &m_statusWidget )
, m_iconUpdated( Resource::loadPixmap( "packagemanager/updated" ) )
, m_iconInstalled( Resource::loadPixmap( "installed" ) )
, m_iconNull( m_iconUpdated.size() )
, m_filterName( QString::null )
, m_filterServer( QString::null )
, m_filterDest( QString::null )
, m_filterStatus( OPackageManager::NotDefined )
, m_filterCategory( QString::null )
{
// setCaption( tr( "Package Manager" ) );
m_iconNull.fill( colorGroup().base() );
connect( &m_widgetStack, SIGNAL(aboutToShow(QWidget*)), this, SLOT(slotWidgetStackShow(QWidget*)) );
// Initialize widget stack, package list and status widget
initStatusWidget();
initPackageList();
m_widgetStack.addWidget( &m_statusWidget, 2 );
m_widgetStack.addWidget( &m_packageList, 1 );
setCentralWidget( &m_widgetStack );
// Initialize remaining user interface items
initUI();
// Initialize package information
QTimer::singleShot( 100, this, SLOT( initPackageInfo() ) );
}
void MainWindow::closeEvent( QCloseEvent *event )
{
// Close app only if either the package or status widgets are currently active
bool close = m_widgetStack.visibleWidget() == &m_packageList ||
m_widgetStack.visibleWidget() == &m_statusWidget;
if ( close )
{
// TODO - write out application configuration settings
// Write out package manager configuration settings
m_packman.saveSettings();
event->accept();
}
else
{
delete m_widgetStack.visibleWidget();
m_widgetStack.raiseWidget( &m_packageList );
event->ignore();
}
}
void MainWindow::initPackageList()
{
m_packageList.addColumn( tr( "Packages" ) );
QWhatsThis::add( &m_packageList, tr( "This is a listing of all packages.\n\nA blue dot next to the package name indicates that the package is currently installed.\n\nA blue dot with a star indicates that a newer version of the package is available from the server feed.\n\nClick inside the box at the left to select a package." ) );
QPEApplication::setStylusOperation( m_packageList.viewport(), QPEApplication::RightOnHold );
- connect( &m_packageList, SIGNAL(rightButtonPressed(QListViewItem *,const QPoint &,int)),
- this, SLOT(slotDisplayPackageInfo(QListViewItem *)) );
+ connect( &m_packageList, SIGNAL(rightButtonPressed(QListViewItem*,const QPoint&,int)),
+ this, SLOT(slotDisplayPackageInfo(QListViewItem*)) );
}
void MainWindow::initStatusWidget()
{
QVBoxLayout *layout = new QVBoxLayout( &m_statusWidget, 4, 4 );
m_statusText.setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
layout->addWidget( &m_statusText );
connect( &m_packman, SIGNAL(initStatus(int)), this, SLOT(slotInitStatusBar(int)) );
- connect( &m_packman, SIGNAL(statusText(const QString &)), this, SLOT(slotStatusText(const QString &)) );
+ connect( &m_packman, SIGNAL(statusText(const QString&)), this, SLOT(slotStatusText(const QString&)) );
connect( &m_packman, SIGNAL(statusBar(int)), this, SLOT(slotStatusBar(int)) );
layout->addWidget( &m_statusBar );
}
void MainWindow::initUI()
{
// Build menu and tool bars
setToolBarsMovable( false );
m_menuBar.setHorizontalStretchable( true );
QMenuBar *mb = new QMenuBar( &m_menuBar );
mb->setMargin( 0 );
// Find toolbar
addToolBar( &m_findBar, QMainWindow::Top, true );
m_findBar.setHorizontalStretchable( true );
m_findEdit = new QLineEdit( &m_findBar );
QWhatsThis::add( m_findEdit, tr( "Type the text to search for here." ) );
m_findBar.setStretchableWidget( m_findEdit );
- connect( m_findEdit, SIGNAL(textChanged(const QString &)), this, SLOT(slotFindChanged(const QString &)) );
+ connect( m_findEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotFindChanged(const QString&)) );
// Packages menu
QPopupMenu *popup = new QPopupMenu( this );
QAction *a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "packagemanager/update" ), QString::null, 0, this, 0 );
a->setWhatsThis( tr( "Click here to update package lists from servers." ) );
connect( a, SIGNAL(activated()), this, SLOT(slotUpdate()) );
a->addTo( popup );
a->addTo( &m_toolBar );
QAction *actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "packagemanager/upgrade" ), QString::null, 0, this, 0 );
actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) );
connect( actionUpgrade, SIGNAL(activated()), this, SLOT(slotUpgrade()) );
actionUpgrade->addTo( popup );
actionUpgrade->addTo( &m_toolBar );
QPixmap iconDownload = Resource::loadPixmap( "packagemanager/download" );
QPixmap iconRemove = Resource::loadPixmap( "packagemanager/remove" );
QAction *actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 );
actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) );
connect( actionDownload, SIGNAL(activated()), this, SLOT(slotDownload()) );
actionDownload->addTo( popup );
actionDownload->addTo( &m_toolBar );
a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "packagemanager/apply" ), QString::null, 0, this, 0 );
a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) );
connect( a, SIGNAL(activated()), this, SLOT(slotApply()) );
a->addTo( popup );
a->addTo( &m_toolBar );
popup->insertSeparator();
a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 );
a->setWhatsThis( tr( "Click here to configure this application." ) );
connect( a, SIGNAL(activated()), this, SLOT(slotConfigure()) );
a->addTo( popup );
mb->insertItem( tr( "Actions" ), popup );
// View menu
popup = new QPopupMenu( this );
m_actionShowNotInstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 );
m_actionShowNotInstalled->setToggleAction( true );
m_actionShowNotInstalled->setWhatsThis( tr( "Click here to show packages available which have not been installed." ) );
connect( m_actionShowNotInstalled, SIGNAL(activated()), this, SLOT(slotShowNotInstalled()) );
m_actionShowNotInstalled->addTo( popup );
m_actionShowInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 );
m_actionShowInstalled->setToggleAction( true );
m_actionShowInstalled->setWhatsThis( tr( "Click here to show packages currently installed on this device." ) );
connect( m_actionShowInstalled, SIGNAL(activated()), this, SLOT(slotShowInstalled()) );
m_actionShowInstalled->addTo( popup );
m_actionShowUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 );
m_actionShowUpdated->setToggleAction( true );
m_actionShowUpdated->setWhatsThis( tr( "Click here to show packages currently installed on this device which have a newer version available." ) );
connect( m_actionShowUpdated, SIGNAL(activated()), this, SLOT(slotShowUpdated()) );
m_actionShowUpdated->addTo( popup );
popup->insertSeparator();
m_actionFilter = new QAction( tr( "Filter" ), Resource::loadPixmap( "packagemanager/filter" ),
QString::null, 0, this, 0 );
m_actionFilter->setToggleAction( true );
m_actionFilter->setWhatsThis( tr( "Click here to apply current filter." ) );
connect( m_actionFilter, SIGNAL(toggled(bool)), this, SLOT(slotFilter(bool)) );
m_actionFilter->addTo( popup );
a = new QAction( tr( "Filter settings" ), QString::null, 0, this, 0 );
a->setWhatsThis( tr( "Click here to change the package filter criteria." ) );
connect( a, SIGNAL(activated()), this, SLOT(slotFilterChange()) );
a->addTo( popup );
popup->insertSeparator();
a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 );
a->setWhatsThis( tr( "Click here to search for text in package names." ) );
connect( a, SIGNAL(activated()), this, SLOT(slotFindShowToolbar()) );
a->addTo( popup );
m_actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 );
m_actionFindNext->setEnabled( false );
m_actionFindNext->setWhatsThis( tr( "Click here to find the next package name containing the text you are searching for." ) );
connect( m_actionFindNext, SIGNAL(activated()), this, SLOT(slotFindNext()) );
m_actionFindNext->addTo( popup );
m_actionFindNext->addTo( &m_findBar );
mb->insertItem( tr( "View" ), popup );
// Finish find toolbar creation
a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
a->setWhatsThis( tr( "Click here to hide the find toolbar." ) );
connect( a, SIGNAL(activated()), this, SLOT(slotFindHideToolbar()) );
a->addTo( &m_findBar );
m_findBar.hide();
}
diff --git a/noncore/settings/packagemanager/oipkg.cpp b/noncore/settings/packagemanager/oipkg.cpp
index 086e91b..1dc23a4 100644
--- a/noncore/settings/packagemanager/oipkg.cpp
+++ b/noncore/settings/packagemanager/oipkg.cpp
@@ -223,242 +223,242 @@ OPackageList *OIpkg::installedPackages( const QString &destName, const QString &
path.append( "/" );
path.append( IPKG_STATUS_PATH );
QFile f( path );
if ( !f.open( IO_ReadOnly ) )
return NULL;
QTextStream t( &f );
// Process all information in status file
bool newPackage = false;
QString line = t.readLine();
QString name;
QString version;
QString status;
while ( !t.eof() )
{
// Determine key/value pair
int pos = line.find( ':', 0 );
QString key;
if ( pos > -1 )
key = line.mid( 0, pos );
else
key = QString::null;
QString value = line.mid( pos+2, line.length()-pos );
// Allocate new package and insert into list
if ( newPackage && !key.isEmpty() )
{
// Add to list only if it has a valid name and is installed
if ( !name.isNull() && status.contains( " installed" ) )
{
pl->append( new OPackage( name, QString::null, version, QString::null, destName ) );
name = QString::null;
version = QString::null;
status = QString::null;
newPackage = false;
}
}
// Update package data
if ( key == "Package" )
name = value;
else if ( key == "Version" )
version = value;
else if ( key == "Status" )
status = value;
else if ( key.isEmpty() && value.isEmpty() )
newPackage = true;
// Skip past all description lines
if ( key == "Description" )
{
line = t.readLine();
while ( !line.isEmpty() && line.find( ':', 0 ) == -1 && !t.eof() )
line = t.readLine();
}
else
line = t.readLine();
}
f.close();
return pl;
}
bool OIpkg::executeCommand( OPackage::Command command, QStringList *parameters, const QString &destination,
const QObject *receiver, const char *slotOutput, bool rawOutput )
{
if ( command == OPackage::NotDefined )
return false;
// Set ipkg run-time options/arguments
m_ipkgArgs.force_depends = ( m_ipkgExecOptions & FORCE_DEPENDS );
m_ipkgArgs.force_reinstall = ( m_ipkgExecOptions & FORCE_REINSTALL );
// TODO m_ipkgArgs.force_remove = ( m_ipkgExecOptions & FORCE_REMOVE );
m_ipkgArgs.force_overwrite = ( m_ipkgExecOptions & FORCE_OVERWRITE );
m_ipkgArgs.verbosity = m_ipkgExecVerbosity;
if ( m_ipkgArgs.dest )
free( m_ipkgArgs.dest );
if ( !destination.isNull() )
{
int len = destination.length() + 1;
m_ipkgArgs.dest = (char *)malloc( len );
strncpy( m_ipkgArgs.dest, destination, destination.length() );
m_ipkgArgs.dest[ len - 1 ] = '\0';
}
else
m_ipkgArgs.dest = 0x0;
// Connect output signal to widget
if ( rawOutput )
{
// if ( slotOutput )
-// connect( this, SIGNAL(signalIpkgMessage(char *)), receiver, slotOutput );
+// connect( this, SIGNAL(signalIpkgMessage(char*)), receiver, slotOutput );
}
else
{
// TODO - connect to local slot and parse output before emitting signalIpkgMessage
}
switch( command )
{
case OPackage::Update : {
- connect( this, SIGNAL(signalIpkgMessage(char *)), receiver, slotOutput );
+ connect( this, SIGNAL(signalIpkgMessage(char*)), receiver, slotOutput );
ipkg_lists_update( &m_ipkgArgs );
};
break;
case OPackage::Upgrade : {
- connect( this, SIGNAL(signalIpkgMessage(char *)), receiver, slotOutput );
+ connect( this, SIGNAL(signalIpkgMessage(char*)), receiver, slotOutput );
ipkg_packages_upgrade( &m_ipkgArgs );
};
break;
case OPackage::Install : {
- connect( this, SIGNAL(signalIpkgMessage(char *)), receiver, slotOutput );
+ connect( this, SIGNAL(signalIpkgMessage(char*)), receiver, slotOutput );
for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it )
{
ipkg_packages_install( &m_ipkgArgs, (*it) );
}
};
break;
case OPackage::Remove : {
- connect( this, SIGNAL(signalIpkgMessage(char *)), receiver, slotOutput );
+ connect( this, SIGNAL(signalIpkgMessage(char*)), receiver, slotOutput );
for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it )
{
ipkg_packages_remove( &m_ipkgArgs, (*it), true );
}
};
break;
case OPackage::Download : {
- connect( this, SIGNAL(signalIpkgMessage(char *)), receiver, slotOutput );
+ connect( this, SIGNAL(signalIpkgMessage(char*)), receiver, slotOutput );
for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it )
{
ipkg_packages_download( &m_ipkgArgs, (*it) );
}
};
break;
case OPackage::Info : {
- connect( this, SIGNAL(signalIpkgStatus(char *)), receiver, slotOutput );
+ connect( this, SIGNAL(signalIpkgStatus(char*)), receiver, slotOutput );
ipkg_packages_info( &m_ipkgArgs, (*parameters->begin()), &fIpkgStatus, 0x0 );
};
break;
case OPackage::Files : {
- connect( this, SIGNAL(signalIpkgList(char *)), receiver, slotOutput );
+ connect( this, SIGNAL(signalIpkgList(char*)), receiver, slotOutput );
ipkg_package_files( &m_ipkgArgs, (*parameters->begin()), &fIpkgFiles, 0x0 );
};
break;
default : break;
};
return true;
}
void OIpkg::ipkgMessage( char *msg )
{
emit signalIpkgMessage( msg );
}
void OIpkg::ipkgStatus( char *status )
{
emit signalIpkgStatus( status );
}
void OIpkg::ipkgList( char *filelist )
{
emit signalIpkgList( filelist );
}
void OIpkg::loadConfiguration()
{
if ( m_confInfo )
delete m_confInfo;
// Load configuration item list
m_confInfo = new OConfItemList();
QStringList confFiles;
QDir confDir( IPKG_CONF_DIR );
if ( confDir.exists() )
{
confDir.setNameFilter( "*.conf" );
confDir.setFilter( QDir::Files );
confFiles = confDir.entryList( "*.conf", QDir::Files );
confFiles << IPKG_CONF;
for ( QStringList::Iterator it = confFiles.begin(); it != confFiles.end(); ++it )
{
// Create absolute file path if necessary
QString absFile = (*it);
if ( !absFile.startsWith( "/" ) )
absFile.prepend( QString( IPKG_CONF_DIR ) + "/" );
// Read in file
QFile f( absFile );
if ( f.open( IO_ReadOnly ) )
{
QTextStream s( &f );
while ( !s.eof() )
{
QString line = s.readLine().simplifyWhiteSpace();
// Parse line and save info to the conf options list
if ( !line.isEmpty() )
{
if ( !line.startsWith( "#" ) ||
line.startsWith( "#src" ) ||
line.startsWith( "#dest" ) ||
line.startsWith( "#arch" ) ||
line.startsWith( "#option" ) )
{
int pos = line.find( ' ', 1 );
// Type
QString typeStr = line.left( pos );
OConfItem::Type type;
if ( typeStr == "src" || typeStr == "#src" )
type = OConfItem::Source;
else if ( typeStr == "dest" || typeStr == "#dest" )
type = OConfItem::Destination;
else if ( typeStr == "option" || typeStr == "#option" )
type = OConfItem::Option;
else if ( typeStr == "arch" || typeStr == "#arch" )
type = OConfItem::Arch;
else
type = OConfItem::NotDefined;
++pos;
int endpos = line.find( ' ', pos );
// Name
QString name = line.mid( pos, endpos - pos );
// Value
QString value = "";
if ( endpos > -1 )
value = line.right( line.length() - endpos - 1 );
// Active
bool active = !line.startsWith( "#" );
diff --git a/noncore/settings/sound/soundsettings.cpp b/noncore/settings/sound/soundsettings.cpp
index 4bc86fa..8ad0a3f 100644
--- a/noncore/settings/sound/soundsettings.cpp
+++ b/noncore/settings/sound/soundsettings.cpp
@@ -18,202 +18,202 @@
**
**********************************************************************/
// parts copyright 2002 L.J. Potter
#include "soundsettings.h"
#include <qpe/qpeapplication.h>
#include <qpe/config.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/storage.h>
#include <qcheckbox.h>
#include <qcombobox.h>
#include <qlabel.h>
#include <sys/utsname.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#include <sys/stat.h>
SoundSettings::SoundSettings( QWidget* parent, const char* objname, WFlags fl )
: SoundSettingsBase( parent, objname, TRUE, fl )
{
keyReset=FALSE;
noWarning=false;
Config config( "qpe");
config.setGroup( "Volume" );
Config cfg("Vmemo");
connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
AlertCheckBox->setChecked(cfg.readBoolEntry("Alert"));
cfg.setGroup("Record");
int rate=config.readNumEntry("SampleRate", 22050);
if(rate == 8000)
sampleRate->setCurrentItem(0);
else if(rate == 11025)
sampleRate->setCurrentItem(1);
else if(rate == 22050)
sampleRate->setCurrentItem(2);
else if(rate == 33075)
sampleRate->setCurrentItem(3);
else if(rate==44100)
sampleRate->setCurrentItem(4);
stereoCheckBox->setChecked(cfg.readNumEntry("Stereo", 0));
//TODO hide if zaurus- mono only
#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX)
//since ipaq and zaurus have particular
//devices
bool systemZaurus=FALSE;
struct utsname name; /* check for embedix kernel running on the zaurus*/
if (uname(&name) != -1) {// TODO change this here,...
QString release=name.release;
if( release.find("embedix",0,TRUE) != -1) {
qDebug("IS System Zaurus");
systemZaurus=TRUE;
}
}
if(!systemZaurus) {
stereoCheckBox->setChecked(TRUE);
}
stereoCheckBox->setEnabled(FALSE);
sixteenBitCheckBox->setEnabled(FALSE);
#else
#endif
int sRate=cfg.readNumEntry("SizeLimit", 30);
qDebug("%d",sRate);
if(sRate ==30)
timeLimitComboBox->setCurrentItem(0);
else if(sRate==20)
timeLimitComboBox->setCurrentItem(1);
else if(sRate == 15)
timeLimitComboBox->setCurrentItem(2);
else if(sRate == 10)
timeLimitComboBox->setCurrentItem(3);
else if(sRate == 5)
timeLimitComboBox->setCurrentItem(4);
else
timeLimitComboBox->setCurrentItem(5);
sixteenBitCheckBox->setChecked(cfg.readNumEntry("SixteenBit", 1));
cfg.setGroup("Defaults");
keyComboBox->setCurrentItem(cfg.readNumEntry("toggleKey") );
updateStorageCombo();
Config vmCfg("Vmemo");
vmCfg.setGroup("Defaults");
adpcmCheckBox->setChecked( vmCfg.readBoolEntry("use_ADPCM", 0));
- connect( LocationComboBox,SIGNAL(activated(const QString &)), this,
- SLOT( setLocation(const QString &)));
- connect( keyComboBox,SIGNAL(activated( int)), this,
- SLOT( setKeyButton( int)));
- connect( timeLimitComboBox,SIGNAL(activated( const QString &)), this,
- SLOT( setSizeLimitButton(const QString &)));
- connect( restartCheckBox,SIGNAL( toggled( bool)), this,
- SLOT( restartOpie( bool)));
- connect( adpcmCheckBox,SIGNAL( toggled( bool)), this,
- SLOT( slotAdpcm( bool)));
+ connect( LocationComboBox,SIGNAL(activated(const QString&)), this,
+ SLOT( setLocation(const QString&)));
+ connect( keyComboBox,SIGNAL(activated(int)), this,
+ SLOT( setKeyButton(int)));
+ connect( timeLimitComboBox,SIGNAL(activated(const QString&)), this,
+ SLOT( setSizeLimitButton(const QString&)));
+ connect( restartCheckBox,SIGNAL( toggled(bool)), this,
+ SLOT( restartOpie(bool)));
+ connect( adpcmCheckBox,SIGNAL( toggled(bool)), this,
+ SLOT( slotAdpcm(bool)));
// connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
}
void SoundSettings::updateStorageCombo() {
Config config( "Vmemo" );
config.setGroup( "System" );
QString loc = config.readEntry("RecLocation","/");
int i=0;
int set=0;
StorageInfo storageInfo;
QString sName, sPath;
QStringList list;
list << "Documents : "+QPEApplication::documentDir();
list << "tmp : /tmp";
const QList<FileSystem> &fs = storageInfo.fileSystems();
QListIterator<FileSystem> it ( fs );
for( ; it.current(); ++it ){
const QString name = (*it)->name();
const QString path = (*it)->path();
qDebug("storage name "+name +" storage path is "+path);
list << name + ": " +path;
if( loc.find( path,0,TRUE) != -1)
set = i;
// if(dit.current()->file().find(path) != -1 ) storage=name;
i++;
}
LocationComboBox->insertStringList(list);
qDebug("set item %d", set);
LocationComboBox->setCurrentItem(set);
}
void SoundSettings::setLocation(const QString & string) {
Config config( "Vmemo" );
config.setGroup( "System" );
config.writeEntry("RecLocation",string);
qDebug("set location "+string);
config.write();
}
void SoundSettings::cleanUp() {
Config cfg("Vmemo");
cfg.writeEntry("Alert",AlertCheckBox->isChecked());
cfg.setGroup("Record");
cfg.writeEntry("SampleRate",sampleRate->currentText());
cfg.writeEntry("Stereo",stereoCheckBox->isChecked());
cfg.writeEntry("SixteenBit",sixteenBitCheckBox->isChecked());
if(keyReset && noWarning) {
QCopEnvelope ("QPE/System", "restart()");
}
}
void SoundSettings::setKeyButton( int index) {
Config cfg("Vmemo");
cfg.setGroup("Defaults");
cfg.writeEntry( "toggleKey", index );
keyReset = TRUE;
if( index == 1) {
cfg.writeEntry( "hideIcon", 0 );
keyLabel->setText(tr("Shows icon"));
}
else {
cfg.writeEntry( "hideIcon", 1);
keyLabel->setText(tr("Hides icon"));
}
cfg.write();
}
void SoundSettings::updateLocationCombo() {
}
void SoundSettings::setSizeLimitButton(const QString &index) {
Config cfg("Vmemo");
cfg.setGroup("Record");
if(index.find("Unlimited",0,TRUE) != -1)
cfg.writeEntry("SizeLimit", -1);
else
cfg.writeEntry("SizeLimit", index);
cfg.write();
}
void SoundSettings::restartOpie(bool b) {
noWarning=b;
}
void SoundSettings::slotAdpcm(bool b) {
Config vmCfg("Vmemo");
vmCfg.setGroup("Defaults");
vmCfg.writeEntry("use_ADPCM", b);
vmCfg.write();
diff --git a/noncore/settings/sysinfo/benchmarkinfo.cpp b/noncore/settings/sysinfo/benchmarkinfo.cpp
index 0aeb251..d6ecec5 100644
--- a/noncore/settings/sysinfo/benchmarkinfo.cpp
+++ b/noncore/settings/sysinfo/benchmarkinfo.cpp
@@ -52,193 +52,193 @@ extern "C"
double dhry_main( int );
}
#define DHRYSTONE_RUNS 20000000
#define TEST_DURATION 3
#define BUFF_SIZE 8192
#define FILE_SIZE 1024 * 1024 // 1Mb
//===========================================================================
class BenchmarkPaintWidget : public QWidget
{
public:
BenchmarkPaintWidget() : QWidget( 0, "Benchmark Paint Widget", WStyle_Customize|WStyle_StaysOnTop|WPaintUnclipped|WPaintClever )
{
resize( QApplication::desktop()->size() );
show();
p.begin( this );
};
~BenchmarkPaintWidget()
{
p.end();
hide();
};
QPainter p;
};
//===========================================================================
BenchmarkInfo::BenchmarkInfo( QWidget *parent, const char *name, int wFlags )
: QWidget( parent, name, wFlags )
{
setMinimumSize( 200, 150 );
QVBoxLayout* vb = new QVBoxLayout( this );
vb->setSpacing( 4 );
vb->setMargin( 4 );
tests = new QListView( this );
tests->setMargin( 0 );
tests->addColumn( tr( "Tests" ) );
tests->addColumn( tr( "Results" ) );
tests->addColumn( tr( "Comparison" ) );
tests->setShowSortIndicator( true );
test_alu = new QCheckListItem( tests, tr( "1. Integer Arithmetic " ), QCheckListItem::CheckBox );
test_fpu = new QCheckListItem( tests, tr( "2. Floating Point Unit " ), QCheckListItem::CheckBox );
test_txt = new QCheckListItem( tests, tr( "3. Text Rendering " ), QCheckListItem::CheckBox );
test_gfx = new QCheckListItem( tests, tr( "4. Gfx Rendering " ), QCheckListItem::CheckBox );
test_ram = new QCheckListItem( tests, tr( "5. RAM Performance " ), QCheckListItem::CheckBox );
test_sd = new QCheckListItem( tests, tr( "6. SD Card Performance " ), QCheckListItem::CheckBox );
test_cf = new QCheckListItem( tests, tr( "7. CF Card Performance " ), QCheckListItem::CheckBox );
test_alu->setText( 1, "n/a" );
test_fpu->setText( 1, "n/a" );
test_txt->setText( 1, "n/a" );
test_gfx->setText( 1, "n/a" );
test_ram->setText( 1, "n/a" );
test_sd->setText( 1, "n/a" );
test_cf->setText( 1, "n/a" );
test_alu->setText( 2, "n/a" );
test_fpu->setText( 2, "n/a" );
test_txt->setText( 2, "n/a" );
test_gfx->setText( 2, "n/a" );
test_ram->setText( 2, "n/a" );
test_sd->setText( 2, "n/a" );
test_cf->setText( 2, "n/a" );
startButton = new QPushButton( tr( "&Start Tests!" ), this );
connect( startButton, SIGNAL( clicked() ), this, SLOT( run() ) );
vb->addWidget( tests, 2 );
QFile f( QPEApplication::qpeDir() + "/share/sysinfo/results" );
if ( f.open( IO_ReadOnly ) )
{
machineCombo = new QComboBox( this );
QTextStream ts( &f );
while( !ts.eof() )
{
QString machline = ts.readLine();
qDebug( "sysinfo: parsing benchmark results for '%s'", (const char*) machline );
QString resline = ts.readLine();
machines.insert( machline, new QStringList( QStringList::split( ",", resline ) ) );
machineCombo->insertItem( machline );
}
QHBoxLayout* hb = new QHBoxLayout( vb );
hb->addWidget( new QLabel( tr( "Compare To:" ), this ) );
hb->addWidget( machineCombo, 2 );
- connect( machineCombo, SIGNAL( activated( int ) ), this, SLOT( machineActivated( int ) ) );
+ connect( machineCombo, SIGNAL( activated(int) ), this, SLOT( machineActivated(int) ) );
}
vb->addWidget( startButton, 2 );
}
BenchmarkInfo::~BenchmarkInfo()
{}
void BenchmarkInfo::machineActivated( int index )
{
QStringList* results = machines[ machineCombo->text( index ) ];
if ( !results )
{
qDebug( "sysinfo: no results available." );
return;
}
QStringList::Iterator it = results->begin();
test_alu->setText( 2, *(it++) );
test_fpu->setText( 2, *(it++) );
test_txt->setText( 2, *(it++) );
test_gfx->setText( 2, *(it++) );
test_ram->setText( 2, *(it++) );
test_sd->setText( 2, *(it++) );
test_cf->setText( 2, *(it++) );
}
void BenchmarkInfo::run()
{
startButton->setText( "> Don't touch! Running Tests! Don't touch! <" );
qApp->processEvents();
QTime t;
if ( test_alu->isOn() )
{
int d = round( dhry_main( DHRYSTONE_RUNS ) );
test_alu->setText( 1, QString( "%1 dhrys" ).arg( QString::number( d ) ) );
test_alu->setOn( false );
}
if ( test_fpu->isOn() )
{
t.start();
BenchFFT();
test_fpu->setText( 1, QString( "%1 secs" ).arg( QString::number( t.elapsed() / 1000.0 ) ) );
test_fpu->setOn( false );
}
if ( test_txt->isOn() )
{
int value = textRendering( TEST_DURATION );
test_txt->setText( 1, QString( "%1 chars/sec" ).arg( QString::number( value / TEST_DURATION ) ) );
test_txt->setOn( false );
}
if ( test_gfx->isOn() )
{
int value = gfxRendering( TEST_DURATION );
test_gfx->setText( 1, QString( "%1 gops/sec" ).arg( QString::number( value / 4 / TEST_DURATION ) ) ); // 4 tests
test_gfx->setOn( false );
}
if ( test_ram->isOn() ) // /tmp is supposed to be in RAM on a PDA
{
performFileTest( "/tmp/benchmarkFile.dat", test_ram );
}
if ( test_cf->isOn() )
{
OStorageInfo storage;
performFileTest( storage.cfPath() + "/benchmarkFile.dat", test_cf );
}
if ( test_sd->isOn() )
{
OStorageInfo storage;
performFileTest( storage.sdPath() + "/benchmarkFile.dat", test_sd );
}
startButton->setText( tr( "&Start Tests!" ) );
}
int BenchmarkInfo::textRendering( int seconds )
{
QTime t;
t.start();
int stop = t.elapsed() + seconds * 1000;
int rr[] = { 255, 255, 255, 0, 0, 0, 0, 128, 128 };
int gg[] = { 0, 255, 0, 0, 255, 255, 0, 128, 128 };
int bb[] = { 0, 0, 255, 0, 0, 255, 255, 128, 0 };
const QString text( "Opie Benchmark Test" );
diff --git a/noncore/settings/sysinfo/modulesinfo.cpp b/noncore/settings/sysinfo/modulesinfo.cpp
index 9cb8ad2..e688a29 100644
--- a/noncore/settings/sysinfo/modulesinfo.cpp
+++ b/noncore/settings/sysinfo/modulesinfo.cpp
@@ -1,154 +1,154 @@
/**********************************************************************
** ModulesInfo
**
** Display Modules information
**
** Copyright (C) 2002, Michael Lauer
** mickey@tm.informatik.uni-frankfurt.de
** http://www.Vanille.de
**
** Based on ProcessInfo by Dan Williams <williamsdr@acm.org>
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
**********************************************************************/
#include "modulesinfo.h"
#include "detail.h"
/* OPIE */
#include <qpe/qpeapplication.h>
/* QT */
#include <qfile.h>
#include <qlayout.h>
#include <qmessagebox.h>
#include <qtimer.h>
#include <qwhatsthis.h>
ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl )
{
QGridLayout *layout = new QGridLayout( this );
layout->setSpacing( 4 );
layout->setMargin( 4 );
ModulesView = new QListView( this );
int colnum = ModulesView->addColumn( tr( "Module" ) );
colnum = ModulesView->addColumn( tr( "Size" ) );
ModulesView->setColumnAlignment( colnum, Qt::AlignRight );
colnum = ModulesView->addColumn( tr( "Use#" ) );
ModulesView->setColumnAlignment( colnum, Qt::AlignRight );
colnum = ModulesView->addColumn( tr( "Used by" ) );
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 * ) ) );
+ connect( ModulesView, SIGNAL( rightButtonPressed(QListViewItem*,const QPoint&,int) ),
+ this, SLOT( viewModules(QListViewItem*) ) );
}
CommandCB = new QComboBox( FALSE, this );
CommandCB->insertItem( "modprobe -r" );
CommandCB->insertItem( "rmmod" );
// I can't think of other useful commands yet. Anyone?
layout->addWidget( CommandCB, 1, 0 );
QWhatsThis::add( CommandCB, tr( "Select a command here and then click the Send button to the right to send the command to module selected above." ) );
QPushButton *btn = new QPushButton( this );
btn->setMinimumSize( QSize( 50, 24 ) );
btn->setMaximumSize( QSize( 50, 24 ) );
btn->setText( tr( "Send" ) );
connect( btn, SIGNAL( clicked() ), this, SLOT( slotSendClicked() ) );
layout->addWidget( btn, 1, 1 );
QWhatsThis::add( btn, tr( "Click here to send the selected command to the module selected above." ) );
QTimer *t = new QTimer( this );
connect( t, SIGNAL( timeout() ), this, SLOT( updateData() ) );
t->start( 5000 );
updateData();
ModulesDtl = new Detail();
QWhatsThis::add( ModulesDtl->detailView, tr( "This area shows detailed information about this module." ) );
}
ModulesInfo::~ModulesInfo()
{}
void ModulesInfo::updateData()
{
char modname[64];
char usage[200];
int modsize, usecount;
QString selectedmod;
QListViewItem *curritem = ModulesView->currentItem();
if ( curritem )
{
selectedmod = curritem->text( 0 );
}
ModulesView->clear();
FILE *procfile = fopen( ( QString ) ( "/proc/modules"), "r");
if ( procfile )
{
QListViewItem *newitem;
QListViewItem *selecteditem = 0x0;
while ( true )
{
modname[0] = '\0';
usage[0] = '\0';
int success = fscanf( procfile, "%s%d%d%[^\n]", modname, &modsize, &usecount, usage );
if ( success == EOF )
break;
QString qmodname = QString( modname );
QString qmodsize = QString::number( modsize ).rightJustify( 6, ' ' );
QString qusecount = QString::number( usecount ).rightJustify( 2, ' ' );
QString qusage = QString( usage );
newitem = new QListViewItem( ModulesView, qmodname, qmodsize, qusecount, qusage );
if ( qmodname == selectedmod )
{
selecteditem = newitem;
}
}
ModulesView->setCurrentItem( selecteditem );
fclose( procfile );
}
}
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 ( QMessageBox::warning( this, modname, capstr,
QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape ) == QMessageBox::Yes )
{
QString command = "/sbin/";
command.append( CommandCB->currentText() );
command.append( " " );
command.append( modname );
diff --git a/noncore/settings/sysinfo/processinfo.cpp b/noncore/settings/sysinfo/processinfo.cpp
index 2a90b0f..69b4ab5 100644
--- a/noncore/settings/sysinfo/processinfo.cpp
+++ b/noncore/settings/sysinfo/processinfo.cpp
@@ -1,151 +1,151 @@
/**********************************************************************
** ProcessInfo
**
** Display process information
**
** Copyright (C) 2002, Dan Williams
** williamsdr@acm.org
** http://draknor.net
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
**********************************************************************/
#include "processinfo.h"
#include "detail.h"
/* OPIE */
#include <qpe/qpeapplication.h>
/* QT */
#include <qdir.h>
#include <qlayout.h>
#include <qmessagebox.h>
#include <qtimer.h>
#include <qwhatsthis.h>
/* STD */
#include <sys/types.h>
#include <signal.h>
ProcessInfo::ProcessInfo( QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl )
{
QGridLayout *layout = new QGridLayout( this );
layout->setSpacing( 4 );
layout->setMargin( 4 );
ProcessView = new QListView( this, "ProcessView" );
int colnum = ProcessView->addColumn( tr( "PID" ) );
ProcessView->setColumnAlignment( colnum, Qt::AlignRight );
colnum = ProcessView->addColumn( tr( "Command" ),96 );
colnum = ProcessView->addColumn( tr( "Status" ) );
colnum = ProcessView->addColumn( tr( "Time" ) );
ProcessView->setColumnAlignment( colnum, Qt::AlignRight );
ProcessView->setAllColumnsShowFocus( TRUE );
QPEApplication::setStylusOperation( ProcessView->viewport(), QPEApplication::RightOnHold );
- connect( ProcessView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ),
- this, SLOT( viewProcess( QListViewItem * ) ) );
+ connect( ProcessView, SIGNAL( rightButtonPressed(QListViewItem*,const QPoint&,int) ),
+ 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" );
SignalCB->insertItem( " 3: SIGQUIT" );
SignalCB->insertItem( " 5: SIGTRAP" );
SignalCB->insertItem( " 6: SIGABRT" );
SignalCB->insertItem( " 9: SIGKILL" );
SignalCB->insertItem( "14: SIGALRM" );
SignalCB->insertItem( "15: SIGTERM" );
SignalCB->insertItem( "18: SIGCONT" );
SignalCB->insertItem( "19: SIGSTOP" );
layout->addWidget( SignalCB, 1, 0 );
QWhatsThis::add( SignalCB, tr( "Select a signal here and then click the Send button to the right to send to this process." ) );
SendButton = new QPushButton( this, "SendButton" );
SendButton->setMinimumSize( QSize( 50, 24 ) );
SendButton->setMaximumSize( QSize( 50, 24 ) );
SendButton->setText( tr( "Send" ) );
connect( SendButton, SIGNAL( clicked() ), this, SLOT( slotSendClicked() ) );
layout->addWidget( SendButton, 1, 1 );
QWhatsThis::add( SendButton, tr( "Click here to send the selected signal to this process." ) );
QTimer *t = new QTimer( this );
connect( t, SIGNAL( timeout() ), this, SLOT( updateData() ) );
t->start( 5000 );
updateData();
ProcessDtl = new Detail();
QWhatsThis::add( ProcessDtl->detailView, tr( "This area shows detailed information about this process." ) );
}
ProcessInfo::~ProcessInfo()
{}
void ProcessInfo::updateData()
{
int pid, ppid, pgrp, session, tty, tpgid, utime, stime, cutime, cstime, counter, priority, starttime,
signal, blocked, sigignore, sigcatch;
uint flags, minflt, cminflt, majflt, cmajflt, timeout, itrealvalue, vsize, rss, rlim, startcode,
endcode, startstack, kstkesp, kstkeip, wchan;
char state;
char comm[64];
QString selectedpid;
QListViewItem *curritem = ProcessView->currentItem();
if ( curritem )
{
selectedpid = curritem->text( 0 );
}
ProcessView->clear();
QListViewItem *newitem;
QListViewItem *selecteditem = 0x0;
QDir *procdir = new QDir("/proc", 0, QDir::Name, QDir::Dirs);
QFileInfoList *proclist = new QFileInfoList(*(procdir->entryInfoList()));
if ( proclist )
{
QFileInfoListIterator it(*proclist);
QFileInfo *f;
while ( ( f = it.current() ) != 0 )
{
++it;
QString processnum = f->fileName();
if ( processnum >= "1" && processnum <= "99999" )
{
FILE *procfile = fopen( ( QString ) ( "/proc/" + processnum + "/stat"), "r");
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 );
processnum = processnum.rightJustify( 5, ' ' );
QString processcmd = QString( comm ).replace( QRegExp( "[()]" ), "" );
QString processstatus = QChar(state);
QString processtime = QString::number( ( utime + stime ) / 100 );
processtime = processtime.rightJustify( 9, ' ' );
fclose( procfile );
newitem = new QListViewItem( ProcessView, processnum, processcmd, processstatus, processtime );
if ( processnum == selectedpid )
{
selecteditem = newitem;
}
}
}
}
ProcessView->setCurrentItem( selecteditem );
diff --git a/noncore/settings/tabmanager/tabmanager.cpp b/noncore/settings/tabmanager/tabmanager.cpp
index ff5957c..15aeaf5 100644
--- a/noncore/settings/tabmanager/tabmanager.cpp
+++ b/noncore/settings/tabmanager/tabmanager.cpp
@@ -1,135 +1,135 @@
#include "tabmanager.h"
#include "app.h"
#include "wait.h"
#include "tabapplnk.h"
#include <qpe/applnk.h>
#include <qdir.h>
#include <qfile.h>
#include <qtextstream.h>
#include <qlistview.h>
#include <qheader.h>
#include <qcombobox.h>
#include <qlineedit.h>
#include <qlabel.h>
#include <qmessagebox.h>
#include <stdlib.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/qpeapplication.h>
#include <qpe/resource.h>
#define HOME_APP_DIR QPEApplication::qpeDir()+"/apps"
#define HOME_APP_INSTALL_DIR "/usr/lib/ipkg/info"
#define NEW_FOLDER "EmptyTab"
#define NEW_APPLICATION "NewApp"
#define APPLICATION_EXTENSION ".desktop"
#define APPLICATION_EXTENSION_LENGTH 8
/**
* Constructor. Sets up signals. Performs initial scan of applications
* and tabs
*/
TabManager::TabManager( QWidget* parent, const char* name):TabManagerBase(parent, name), changed(false), application(NULL){
rescanFolder(HOME_APP_DIR);
// Connect the signals and slots
- connect(tabList, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(editItem(QListViewItem*)));
+ connect(tabList, SIGNAL(doubleClicked(QListViewItem*)), this, SLOT(editItem(QListViewItem*)));
(tabList->header())->hide();
- connect(tabList, SIGNAL(moveItem(QListViewItem *, QListViewItem *)), this, SLOT(moveApplication(QListViewItem *, QListViewItem *)));
+ connect(tabList, SIGNAL(moveItem(QListViewItem*,QListViewItem*)), this, SLOT(moveApplication(QListViewItem*,QListViewItem*)));
}
/**
* If anything in the tab's have been changed then update the system or alert
* the user.
*/
TabManager::~TabManager(){
if(changed){
// Prompt.
//int answer = QMessageBox::warning(this, "Message", "Should your desktop be","Yes", "Cancel", 0, 1 );
//if (answer)
// return;
QCopEnvelope e("QPE/System", "linkChanged(QString)");
QString link; //we'll just send an empty string
e << link;
}
}
/**
* Scans root directory for any tabs or applications. Will recursivly go down,
* but will not follow symlinks.
* @param directory - the directory to look in.
* @param parent - the parent to place any new tabs or apps into. If parent is
* NULL then the item is a tab and should be placed as a child of the window.
*/
void TabManager::rescanFolder(QString directory, QListViewItem* parent){
//qDebug(QString("rescanFolder: ") + directory.latin1());
QDir d;
d.setPath(directory);
// Show hidden files for .directories
d.setFilter( QDir::Files | QDir::Hidden | QDir::Dirs);
const QFileInfoList *list = d.entryInfoList();
QFileInfoListIterator it( *list ); // create list iterator
QFileInfo *fi; // pointer for traversing
while ( (fi=it.current()) ) { // for each file...
// If it is a dir and not .. or . then add it as a tab and go down.
if(fi->isDir()){
if(fi->fileName() != ".." && fi->fileName() != ".") {
QListViewItem* newItem;
if(!parent)
newItem = new QListViewItem(tabList, fi->fileName());
else
newItem = new QListViewItem(parent, fi->fileName());
itemList.insert(newItem, directory + "/" + fi->fileName() + "/.directory" );
rescanFolder(directory + "/" + fi->fileName(), newItem);
}
}
else{
// it is a file, if not a .directory add to parent.
// Change parents name and icon to reflect icon.
if(fi->fileName() == ".directory"){
AppLnk app(directory + "/" + fi->fileName());
if(parent){
parent->setPixmap(0,app.pixmap());
parent->setText(0, app.name());
}
}
else{
// Add any desktop files found.
QListViewItem* newItem;
if(directory != HOME_APP_DIR){
if(!parent)
newItem = new QListViewItem(tabList, fi->fileName());
else
newItem = new QListViewItem(parent, fi->fileName());
if(fi->fileName().right(APPLICATION_EXTENSION_LENGTH) == APPLICATION_EXTENSION){
AppLnk app(directory + "/" + fi->fileName());
newItem->setPixmap(0,app.pixmap());
newItem->setText(0, app.name());
itemList.insert(newItem, directory + "/" + fi->fileName());
}
}
}
}
++it; // goto next list element
}
}
/**
* Create a new blank Tab.
* Create a physical folder with .directory file
* Create a item on the list
*/
void TabManager::newFolder(){
QDir r;
r.mkdir(QString(HOME_APP_DIR) + "/" + NEW_FOLDER);
system((QString("echo [Desktop Entry] | cat >> ") + HOME_APP_DIR + "/" + NEW_FOLDER "/.directory").latin1());
system((QString("echo Name=" NEW_FOLDER " | cat >> ") + HOME_APP_DIR + "/" + NEW_FOLDER "/.directory").latin1());
QString homeLocation = QString(HOME_APP_DIR) + "/" + NEW_FOLDER + "/.directory";
QListViewItem *newItem = new QListViewItem(tabList, NEW_FOLDER);
itemList.insert(newItem, homeLocation );
diff --git a/noncore/settings/usermanager/usermanager.cpp b/noncore/settings/usermanager/usermanager.cpp
index 5411995..a1130d4 100644
--- a/noncore/settings/usermanager/usermanager.cpp
+++ b/noncore/settings/usermanager/usermanager.cpp
@@ -1,176 +1,176 @@
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "usermanager.h"
#include <qlayout.h>
#include <qmessagebox.h>
#include <qfile.h>
#include <qpe/resource.h>
#include <qregexp.h>
/**
* The mainwindow constructor.
*
* @param QWidget *parent
* @param const char *name
* @ param WFlags fl
*
*/
UserConfig::UserConfig(QWidget* parent, const char* name, WFlags fl) : QMainWindow(parent, name, fl) {
setCaption(tr("Opie User Manager"));
// Create an instance of the global object 'accounts'. This holds all user/group info, and functions to modify them.
accounts=new Passwd();
accounts->open(); // This actually loads the files /etc/passwd & /etc/group into memory.
// Create the toolbar.
QToolBar *toolbar = new QToolBar(this,"Toolbar");
toolbar->setHorizontalStretchable(1); // Is there any other way to get the toolbar to stretch of the full screen!?
adduserToolButton = new QToolButton(Resource::loadPixmap("usermanager/adduser"),"Add User",0,this,SLOT(addUser()),toolbar,"Add User");
edituserToolButton = new QToolButton(Resource::loadPixmap("usermanager/edituser"),"Edit User",0,this,SLOT(editUser()),toolbar,"Edit User");
deleteuserToolButton = new QToolButton(Resource::loadPixmap("usermanager/deleteuser"),"Delete User",0,this,SLOT(delUser()),toolbar,"Delete User");
QToolButton *userstext = new QToolButton(0,"User",0,0,0,toolbar,"User");
userstext->setUsesTextLabel(true);
toolbar->addSeparator();
addgroupToolButton = new QToolButton(Resource::loadPixmap("usermanager/addgroup"),"Add Group",0,this,SLOT(addGroup()),toolbar,"Add Group");
editgroupToolButton = new QToolButton(Resource::loadPixmap("usermanager/editgroup"),"Edit Group",0,this,SLOT(editGroup()),toolbar,"Edit Group");
deletegroupToolButton = new QToolButton(Resource::loadPixmap("usermanager/deletegroup"),"Delete Group",0,this,SLOT(delGroup()),toolbar,"Delete Group");
QToolButton *groupstext = new QToolButton(0,"Group",0,0,0,toolbar,"Group");
groupstext->setUsesTextLabel(true);
addToolBar(toolbar,"myToolBar");
// Add a tabwidget and all the tabs.
myTabWidget = new QTabWidget(this,"My Tab Widget");
setupTabAccounts();
setupTabAllUsers();
setupTabAllGroups();
userPopupMenu.insertItem("Copy",0);
getUsers(); // Fill out the iconview & listview with all users.
getGroups(); // Fill out the group listview with all groups.
setCentralWidget(myTabWidget);
}
UserConfig::~UserConfig() {
accounts->close();
delete accounts;
}
void UserConfig::setupTabAccounts() {
QWidget *tabpage = new QWidget(this);
QVBoxLayout *layout = new QVBoxLayout(tabpage);
layout->setMargin(5);
usersIconView=new QListView(tabpage,"users");
usersIconView->addColumn("Icon");
usersIconView->addColumn("Username");
usersIconView->setAllColumnsShowFocus(true);
layout->addWidget(usersIconView);
- connect(usersIconView,SIGNAL(returnPressed(QListViewItem *)),this,SLOT(showUserMenu(QListViewItem *)));
+ connect(usersIconView,SIGNAL(returnPressed(QListViewItem*)),this,SLOT(showUserMenu(QListViewItem*)));
myTabWidget->addTab(tabpage,"Users");
}
void UserConfig::setupTabAllUsers() {
QWidget *tabpage = new QWidget(this);
QVBoxLayout *layout = new QVBoxLayout(tabpage);
layout->setMargin(5);
usersListView=new QListView(tabpage,"allusers");
usersListView->addColumn("UID");
usersListView->addColumn("Login");
usersListView->addColumn("Username");
layout->addWidget(usersListView);
usersListView->setSorting(1,1);
usersListView->setAllColumnsShowFocus(true);
myTabWidget->addTab(tabpage,"All Users");
}
void UserConfig::setupTabAllGroups() {
QWidget *tabpage = new QWidget(this);
QVBoxLayout *layout = new QVBoxLayout(tabpage);
layout->setMargin(5);
groupsListView=new QListView(tabpage,"groups");
groupsListView->addColumn("GID");
groupsListView->addColumn("Groupname");
layout->addWidget(groupsListView);
groupsListView->setSorting(1,1);
groupsListView->setAllColumnsShowFocus(true);
myTabWidget->addTab(tabpage,"All Groups");
}
void UserConfig::getUsers() {
QString mytext;
QPixmap mypixmap;
QListViewItem *listviewitem;
// Empty the iconview & the listview.
usersIconView->clear();
usersListView->clear();
// availableUID is used as a deposite for the next available UID on the system, this should start at an ID over 500.
availableUID=500;
for(QStringList::Iterator it=accounts->passwdStringList.begin(); it!=accounts->passwdStringList.end(); ++it) {
accounts->splitPasswdEntry(*it); // Split the string into it's components and store in variables in the accounts object. ("pr_name" and so on.)
if(accounts->pw_name.find(QRegExp("^#"),0)) { // Skip commented lines.
new QListViewItem(usersListView,QString::number(accounts->pw_uid),accounts->pw_name,accounts->pw_gecos);
if((accounts->pw_uid>=500) && (accounts->pw_uid<65000)) { // Is this user a "normal" user ?
mytext=QString(accounts->pw_name)+" - ("+QString(accounts->pw_gecos)+")"; // The string displayed next to the icon.
if(!(mypixmap.load("/opt/QtPalmtop/pics/users/"+accounts->pw_name+".png"))) { // Is there an icon for this user? Resource::loadPixmap is caching, doesn't work.
mypixmap=Resource::loadPixmap(QString("usermanager/usericon")); // If this user has no icon, load the default icon.
}
listviewitem=new QListViewItem(usersIconView,"",mytext); // Add the icon+text to the qiconview.
listviewitem->setPixmap(0,mypixmap);
}
if((accounts->pw_uid>=availableUID) && (accounts->pw_uid<65000)) availableUID=accounts->pw_uid+1; // Increase 1 to the latest know UID to get a free uid.
}
}
usersIconView->sort();
}
void UserConfig::addUser() {
if(UserDialog::addUser(availableUID,availableGID)) { // Add the user to the system, also send next available UID and GID.
getUsers(); // Update users views.
getGroups(); // Update groups view.
}
}
void UserConfig::editUser() {
QString username;
if(myTabWidget->currentPageIndex()==0) { // Users
if(usersIconView->currentItem()) { // Any icon selected?
username=usersIconView->currentItem()->text(1); // Get the text associated with the icon.
username=username.left(username.find(" - (",0,true)); // Strip out the username.
if(UserDialog::editUser(username)) { // Bring up the userinfo dialog.
// If there were any changed also update the views.
getUsers();
getGroups();
}
} else {
QMessageBox::information(this,"No selection.","No user has been selected.");
}
}
if(myTabWidget->currentPageIndex()==1) { // All users
if(usersListView->currentItem()) { // Anything changed!?
username=usersListView->currentItem()->text(1); // Get the username.
if(UserDialog::editUser(username)) { // Bring up the userinfo dialog.
// And again update the views if there were any changes.
getUsers();
getGroups();
}
} else {
QMessageBox::information(this,"No selection.","No user has been selected.");
}