-rw-r--r-- | core/settings/button/remapdlg.cpp | 16 | ||||
-rw-r--r-- | core/settings/citytime/citytime.cpp | 6 | ||||
-rw-r--r-- | core/settings/citytime/citytimebase.cpp | 10 | ||||
-rw-r--r-- | core/settings/citytime/zonemap.cpp | 12 | ||||
-rw-r--r-- | core/settings/launcher/doctabsettings.cpp | 6 | ||||
-rw-r--r-- | core/settings/launcher/inputmethodsettings.cpp | 6 | ||||
-rw-r--r-- | core/settings/launcher/tabdialog.cpp | 18 | ||||
-rw-r--r-- | core/settings/launcher/taskbarsettings.cpp | 22 | ||||
-rw-r--r-- | core/settings/light-and-power/light.cpp | 7 | ||||
-rw-r--r-- | core/settings/security/security.cpp | 8 | ||||
-rw-r--r-- | core/settings/security/security.pro | 2 | ||||
-rw-r--r-- | core/symlinker/main.cpp | 34 | ||||
-rw-r--r-- | core/symlinker/symlinker.pro | 2 | ||||
-rw-r--r-- | core/tools/quicklauncher/main.cpp | 19 |
14 files changed, 111 insertions, 57 deletions
diff --git a/core/settings/button/remapdlg.cpp b/core/settings/button/remapdlg.cpp index 4effebc..cadb955 100644 --- a/core/settings/button/remapdlg.cpp +++ b/core/settings/button/remapdlg.cpp @@ -1,38 +1,44 @@ + +#include "remapdlg.h" +#include "buttonutils.h" + +/* OPIE */ +#include <opie2/odebug.h> + +/* QT */ #include <qlistview.h> #include <qcombobox.h> #include <qtimer.h> -#include "remapdlg.h" -#include "buttonutils.h" using namespace Opie::Core; class NoSortItem : public QListViewItem { public: NoSortItem ( QListView *lv, uint pos, const QString &str, const QCString &s1 = 0, const QCString &s2 = 0 ) : QListViewItem ( lv, str, s1, s2 ) { m_key = QString ( QChar ( 'a' + pos )); m_def = false; } void setDefault ( bool b ) { m_def = b; } virtual QString key ( int /*column*/, bool /*ascending*/ ) const { return m_key; } virtual void paintCell ( QPainter * p, const QColorGroup & cg, int column, int width, int align ) { if ( m_def ) { QFont f ( listView ( )-> font ( )); f. setBold ( true ); p-> setFont ( f ); } QListViewItem::paintCell ( p, cg, column, width, align ); } @@ -79,74 +85,74 @@ RemapDlg::RemapDlg ( const Opie::Core::ODeviceButton *b, bool hold, QWidget *par w_list-> setCurrentItem ( m_current ); QTimer::singleShot ( 0, this, SLOT( delayedInit())); } RemapDlg::~RemapDlg ( ) { } void RemapDlg::delayedInit ( ) { bool b = w_list-> viewport ( )-> isUpdatesEnabled ( ); w_list-> viewport ( )-> setUpdatesEnabled ( false ); ButtonUtils::inst ( )-> insertAppLnks ( m_map_show ); w_list-> viewport ( )-> setUpdatesEnabled ( b ); m_map_show-> repaint ( ); } void RemapDlg::itemChanged ( QListViewItem *it ) { bool enabled = false; OQCopMessage m; m_current = it; if ( it == m_map_none ) { m_msg = m = OQCopMessage ( "ignore", 0 ); - qDebug ("***ignoring"); + odebug << "***ignoring" << oendl; } else if ( it == m_map_preset ) { m_msg = m = m_msg_preset; - qDebug ("***Preset"); + odebug << "***Preset" << oendl; } else if ( it && !it-> childCount ( ) ) { - qDebug ("***Custom: %s %s ",it-> text ( 1 ). latin1 ( ), it-> text ( 2 ). latin1 ( )); + odebug << "***Custom: " << it-> text ( 1 ). latin1 ( ) << " " << it-> text ( 2 ). latin1 ( ) << oendl; enabled = ( it == m_map_custom ); m_msg = m = OQCopMessage ( it-> text ( 1 ). latin1 ( ), it-> text ( 2 ). latin1 ( )); } w_channel-> setEnabled ( enabled ); w_message-> setEnabled ( enabled ); w_channel-> setEditText ( m. channel ( )); //hack for if user has typed in a message, such as 'suspend()' //so raise() is always present if(m. message ( ) != "raise()") w_message->insertItem("raise()"); w_message-> setEditText ( m. message ( )); } void RemapDlg::textChanged ( const QString &str ) { if ( !m_current ) return; QComboBox *which = (QComboBox *) sender ( ); if ( which == w_channel ) m_current-> setText ( 1, str ); else if ( which == w_message ) m_current-> setText ( 2, str ); } OQCopMessage RemapDlg::message ( ) { //make sure to update message if typed in itemChanged(w_list->currentItem()); diff --git a/core/settings/citytime/citytime.cpp b/core/settings/citytime/citytime.cpp index 721285d..d73bda1 100644 --- a/core/settings/citytime/citytime.cpp +++ b/core/settings/citytime/citytime.cpp @@ -1,81 +1,85 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of Qtopia Environment. ** ** 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. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ // changes by Maximilian Reiss <harlekin@handhelds.org> #include "zonemap.h" #include "citytime.h" +/* OPIE */ #include <qpe/qpeapplication.h> #include <qpe/config.h> #include <qpe/tzselect.h> #if !defined(QT_NO_COP) #include <qpe/qcopenvelope_qws.h> #endif +#include <opie2/odebug.h> +/* QT */ #include <qlabel.h> #include <qmessagebox.h> #include <qtoolbutton.h> #include <qlayout.h> +/* STD */ #include <stdlib.h> CityTime::CityTime( QWidget *parent, const char* name, WFlags fl ) : CityTimeBase( parent, name, fl ), strRealTz(0), bAdded(false) { Config config( "qpe" ); config.setGroup( "Time" ); bWhichClock = config.readBoolEntry( "AMPM", TRUE ); - qDebug( QString("%1").arg(bWhichClock) ); + odebug << QString("%1").arg(bWhichClock) << oendl; frmMap->changeClock( bWhichClock ); char *pEnv; pEnv = NULL; pEnv = getenv("TZ"); if ( pEnv ) strRealTz = pEnv; pEnv = NULL; pEnv = getenv("HOME"); if ( pEnv ) strHome = pEnv; // append the labels to their respective lists... listCities.setAutoDelete( true ); listTimes.setAutoDelete( true ); listCities.append( cmdCity1 ); listCities.append( cmdCity2 ); listCities.append( cmdCity3 ); listTimes.append( lblCTime1 ); listTimes.append( lblCTime2 ); listTimes.append( lblCTime3 ); // kludgy way of getting the screen size so we don't have to depend // on a resize event... QWidget *d = QApplication::desktop(); if ( d->width() < d->height() ) { // append for that 4 down look listCities.append( cmdCity4 ); listCities.append( cmdCity5 ); listCities.append( cmdCity6 ); diff --git a/core/settings/citytime/citytimebase.cpp b/core/settings/citytime/citytimebase.cpp index 323929b..77cb91d 100644 --- a/core/settings/citytime/citytimebase.cpp +++ b/core/settings/citytime/citytimebase.cpp @@ -1,41 +1,45 @@ // changes by Maximilian Reiss <harlekin@handhelds.org> #include "citytimebase.h" +#include "zonemap.h" + +/* OPIE */ +#include <opie2/odebug.h> +/* QT */ #include <qlabel.h> #include <qtoolbutton.h> -#include "zonemap.h" #include <qlayout.h> #include <qwhatsthis.h> /* * Constructs a CityTimeBase which is a child of 'parent', with the * name 'name' and widget flags set to 'f' */ CityTimeBase::CityTimeBase( QWidget* parent, const char* name, WFlags ) : QWidget( parent, name, WStyle_ContextHelp ) { if ( !name ) setName( "CityTimeBase" ); setCaption( tr( "City Time" ) ); CityTimeBaseLayout = new QVBoxLayout( this ); CityTimeBaseLayout->setSpacing( 3 ); CityTimeBaseLayout->setMargin( 0 ); frmMap = new ZoneMap( this, "frmMap" ); frmMap->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, frmMap->sizePolicy().hasHeightForWidth() ) ); CityTimeBaseLayout->addWidget( frmMap ); buttonWidget = new QWidget( this ); QWhatsThis::add( buttonWidget, tr( "Click on one of the set cities to replace it" ) ); Layout2 = new QGridLayout( buttonWidget ); Layout2->setSpacing( 3 ); Layout2->setMargin( 4 ); cmdCity7 = new QToolButton( buttonWidget, "cmdCity7" ); cmdCity7->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity7->sizePolicy().hasHeightForWidth() ) ); QFont cmdCity7_font( cmdCity7->font() ); cmdCity7_font.setBold( TRUE ); @@ -372,40 +376,40 @@ bool CityTimeBase::event( QEvent* ev ) lblCTime1_font.setPointSize( 10 ); lblCTime1->setFont( lblCTime1_font ); QFont cmdCity3_font( cmdCity3->font() ); cmdCity3_font.setBold( TRUE ); cmdCity3->setFont( cmdCity3_font ); QFont lblCTime8_font( lblCTime8->font() ); lblCTime8_font.setPointSize( 10 ); lblCTime8->setFont( lblCTime8_font ); QFont cmdCity1_font( cmdCity1->font() ); cmdCity1_font.setBold( TRUE ); cmdCity1->setFont( cmdCity1_font ); QFont lblCTime7_font( lblCTime7->font() ); lblCTime7_font.setPointSize( 10 ); lblCTime7->setFont( lblCTime7_font ); QFont lblCTime4_font( lblCTime4->font() ); lblCTime4_font.setPointSize( 10 ); lblCTime4->setFont( lblCTime4_font ); QFont cmdCity5_font( cmdCity5->font() ); cmdCity5_font.setBold( TRUE ); cmdCity5->setFont( cmdCity5_font ); QFont lblCTime3_font( lblCTime3->font() ); lblCTime3_font.setPointSize( 10 ); lblCTime3->setFont( lblCTime3_font ); QFont cmdCity9_font( cmdCity9->font() ); cmdCity9_font.setBold( TRUE ); cmdCity9->setFont( cmdCity9_font ); } return ret; } void CityTimeBase::beginNewTz() { - qWarning( "CityTimeBase::beginNewTz(): Not implemented yet!" ); + owarn << "CityTimeBase::beginNewTz(): Not implemented yet!" << oendl; } void CityTimeBase::slotNewTz(const QString &, const QString &) { - qWarning( "CityTimeBase::slotNewTz(const QString &, const QString &): Not implemented yet!" ); + owarn << "CityTimeBase::slotNewTz(const QString &, const QString &): Not implemented yet!" << oendl; } diff --git a/core/settings/citytime/zonemap.cpp b/core/settings/citytime/zonemap.cpp index b6843d2..e4a25ef 100644 --- a/core/settings/citytime/zonemap.cpp +++ b/core/settings/citytime/zonemap.cpp @@ -1,71 +1,75 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of Qtopia Environment. ** ** 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. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ // changes by Maximilian Reiss <harlekin@handhelds.org> #include "sun.h" #include "zonemap.h" +/* OPIE */ #include <qpe/resource.h> #include <qpe/qpeapplication.h> +#include <opie2/odebug.h> +/* QT */ #include <qfile.h> #include <qlabel.h> #include <qmessagebox.h> #include <qtextstream.h> #include <qtimer.h> #include <qtoolbutton.h> #include <qlayout.h> #include <qhbox.h> #include <qlistview.h> #include <qwhatsthis.h> +/* STD */ #include <limits.h> // the map file... static const char strZONEINFO[] = "/usr/share/zoneinfo/zone.tab"; static const char strMAP[] = "citytime/simple_grid_400"; // the maximum distance we'll allow the pointer to be away from a city // and still show the city's time static const int iTHRESHOLD = 50000; // The label offset (how far away from pointer) static const int iLABELOFFSET = 8; // the size of the dot to draw, and where to start it static const int iCITYSIZE = 3; const int iCITYOFFSET = 2; // the darkening function static inline void darken( QImage *pImage, int start, int stop, int row ); static void dayNight( QImage *pImage ); ZoneField::ZoneField( const QString& strLine ) { // make a bunch of RegExp's to match the data from the line QRegExp regCoord( "[-+][0-9]+" ); // the latitude QRegExp regCountry( "[A-Za-z]+/" ); // the country (not good enough) QRegExp regCity( "[A-Za-z_-]*" ); // the city int iStart, iStop, iLen, tmp; @@ -101,68 +105,68 @@ ZoneField::ZoneField( const QString& strLine ) tmp = strTmp.toInt(); if ( iLen < 8 ) { _x = tmp / 100; _x *= 60; _x += tmp % 100; _x *= 60; } else { _x = tmp / 10000; _x *= 60; tmp %= 10000; _x += tmp / 100; _x *= 60; tmp %= 100; _x += tmp; } } iStart = regCountry.match( strLine, 0, &iLen ); // help with the shortcoming in 2.x regexp... iStop = strLine.findRev( '/' ); if ( iStart >= 0 ) { iLen = (iStop - iStart) + 1; strCountry = strLine.mid( iStart, iLen ); } // now match the city... iStart = regCity.match( strLine, iStart + iLen, &iLen ); if ( iStart >= 0 ) { strCity = strLine.mid( iStart, iLen ); } } void ZoneField::showStructure( void ) const { - qDebug( "Country: %s", strCountry.latin1() ); - qDebug( "City: %s", strCity.latin1() ); - qDebug( "x: %d", _x ); - qDebug( "y: %d\n", _y ); + odebug << "Country: " << strCountry << "" << oendl; + odebug << "City: " << strCity << "" << oendl; + odebug << "x: " << _x << "" << oendl; + odebug << "y: " << _y << "\n" << oendl; } ZoneMap::ZoneMap( QWidget *parent, const char* name ) : QScrollView( parent, name ), pLast( 0 ), pRepaint( 0 ), ox( 0 ), oy( 0 ), drawableW( -1 ), drawableH( -1 ), bZoom( FALSE ), bIllum( TRUE ), cursor( 0 ) { viewport()->setFocusPolicy( StrongFocus ); // set mouse tracking so we can use the mouse move event zones.setAutoDelete( true ); // get the map loaded // just set the current image to point pixCurr = new QPixmap(); QPixmap pixZoom = Resource::loadPixmap( "mag" ); cmdZoom = new QToolButton( this, "Zoom command" ); cmdZoom->setPixmap( pixZoom ); cmdZoom->setToggleButton( true ); cmdZoom->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, cmdZoom->sizePolicy().hasHeightForWidth() ) ); cmdZoom->setMaximumSize( cmdZoom->sizeHint() ); diff --git a/core/settings/launcher/doctabsettings.cpp b/core/settings/launcher/doctabsettings.cpp index 179a7f9..dfdc9be 100644 --- a/core/settings/launcher/doctabsettings.cpp +++ b/core/settings/launcher/doctabsettings.cpp @@ -1,68 +1,72 @@ /* This file is part of the OPIE Project =. Copyright (c) 2002 Trolltech AS <info@trolltech.com> .=l. Copyright (c) 2003 Michael Lauer <mickeyl@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 "doctabsettings.h" +/* OPIE */ #include <qpe/config.h> +#include <opie2/odebug.h> +/* QT */ #include <qcheckbox.h> #include <qlayout.h> #include <qlabel.h> #include <qwhatsthis.h> + DocTabSettings::DocTabSettings( QWidget *parent, const char *name ):QWidget( parent, name ) { QBoxLayout *lay = new QVBoxLayout( this, 4, 4 ); _enable = new QCheckBox( tr( "Enable the Documents Tab" ), this ); Config cfg( "Launcher" ); cfg.setGroup( "DocTab" ); _enable->setChecked( cfg.readBoolEntry( "Enable", true ) ); lay->addWidget( _enable ); lay->addWidget( new QLabel( tr( "<b>Note:</b> Changing these settings may need restarting Opie to become effective." ), this ) ); lay->addStretch(); QWhatsThis::add( _enable, tr( "Check, if you want the Documents Tab to be visible." ) ); } void DocTabSettings::appletChanged() { } void DocTabSettings::accept() { - qDebug( "DocTabSettings::accept()" ); + odebug << "DocTabSettings::accept()" << oendl; Config cfg( "Launcher" ); cfg.setGroup( "DocTab" ); cfg.writeEntry( "Enable", _enable->isChecked() ); cfg.write(); } diff --git a/core/settings/launcher/inputmethodsettings.cpp b/core/settings/launcher/inputmethodsettings.cpp index e342c09..0422075 100644 --- a/core/settings/launcher/inputmethodsettings.cpp +++ b/core/settings/launcher/inputmethodsettings.cpp @@ -1,84 +1,88 @@ /* This file is part of the OPIE Project =. Copyright (c) 2002 Trolltech AS <info@trolltech.com> .=l. Copyright (c) 2003 Michael Lauer <mickeyl@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 "inputmethodsettings.h" +/* OPIE */ #include <qpe/config.h> +#include <opie2/odebug.h> +/* QT */ #include <qspinbox.h> #include <qcheckbox.h> #include <qlayout.h> #include <qlabel.h> #include <qwhatsthis.h> + InputMethodSettings::InputMethodSettings( QWidget *parent, const char *name ):QWidget( parent, name ) { QBoxLayout *lay = new QVBoxLayout( this, 4, 4 ); _resize = new QCheckBox( tr( "Resize application on Popup" ), this ); _float = new QCheckBox( tr( "Enable floating and resizing" ), this ); QHBoxLayout* hbox = new QHBoxLayout( lay, 4 ); hbox->addWidget( new QLabel( "Initial Width:", this ) ); _size = new QSpinBox( 10, 100, 10, this ); _size->setSuffix( "%" ); hbox->addWidget( _size ); hbox->addStretch(); Config cfg( "Launcher" ); cfg.setGroup( "InputMethods" ); _resize->setChecked( cfg.readBoolEntry( "Resize", true ) ); _float->setChecked( cfg.readBoolEntry( "Float", false ) ); _size->setValue( cfg.readNumEntry( "Width", 100 ) ); lay->addWidget( _resize ); lay->addWidget( _float ); lay->addWidget( new QLabel( tr( "<b>Note:</b> Changing these settings may need restarting Opie to become effective." ), this ) ); lay->addStretch(); QWhatsThis::add( _resize, tr( "Check, if you want the application to be automatically resized if the input method pops up." ) ); QWhatsThis::add( _float, tr( "Check, if you want to move and/or resize input methods" ) ); QWhatsThis::add( _size, tr( "Specify the percentage of the screen width for the input method" ) ); } void InputMethodSettings::appletChanged() { } void InputMethodSettings::accept() { - qDebug( "InputMethodSettings::accept()" ); + odebug << "InputMethodSettings::accept()" << oendl; Config cfg( "Launcher" ); cfg.setGroup( "InputMethods" ); cfg.writeEntry( "Resize", _resize->isChecked() ); cfg.writeEntry( "Float", _float->isChecked() ); cfg.writeEntry( "Width", _size->value() ); cfg.write(); } diff --git a/core/settings/launcher/tabdialog.cpp b/core/settings/launcher/tabdialog.cpp index 763b360..546e229 100644 --- a/core/settings/launcher/tabdialog.cpp +++ b/core/settings/launcher/tabdialog.cpp @@ -1,79 +1,81 @@ /* =. This file is part of the OPIE Project .=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 "tabdialog.h" + +/* OPIE */ #include <qpe/resource.h> +#include <opie2/ofontselector.h> +#include <opie2/otabwidget.h> +#include <opie2/ocolorbutton.h> +#include <opie2/ofiledialog.h> +#include <opie2/odebug.h> +/* QT */ #include <qlayout.h> #include <qvbox.h> #include <qtabbar.h> #include <qiconview.h> #include <qapplication.h> #include <qlabel.h> #include <qradiobutton.h> #include <qbuttongroup.h> #include <qwhatsthis.h> #include <qcheckbox.h> -#include <opie2/ofontselector.h> -#include <opie2/otabwidget.h> -#include <opie2/ocolorbutton.h> -#include <opie2/ofiledialog.h> - -#include "tabdialog.h" - using namespace Opie::Ui; class SampleItem : public QIconViewItem { public: SampleItem ( QIconView *v, const QString &text, const QPixmap &pix ) : QIconViewItem ( v, text ) { m_large = pix; m_small. convertFromImage ( pix. convertToImage ( ). smoothScale ( pix. width ( ) / 2, pix. height ( ) / 2 )); } void sizeChange ( ) { calcRect ( ); repaint ( ); } QPixmap *pixmap ( ) const { if ( iconView ( )-> itemTextPos ( ) == QIconView::Right ) return (QPixmap *) &m_small; else return (QPixmap *) &m_large; } private: QPixmap m_large, m_small; }; class SampleView : public QIconView { public: SampleView ( QWidget *parent = 0, const char *name = 0 ) : QIconView ( parent, name ) { @@ -119,65 +121,65 @@ public: update ( ); } void setBackgroundType( TabConfig::BackgroundType t, const QString &val ) { switch ( t ) { case TabConfig::Ruled: { QPixmap bg ( width ( ), 9 ); QPainter painter ( &bg ); for ( int i = 0; i < 3; i++ ) { painter. setPen ( white ); painter. drawLine ( 0, i*3, width()-1, i*3 ); painter. drawLine ( 0, i*3+1, width()-1, i*3+1 ); painter. setPen ( colorGroup().background().light(105) ); painter. drawLine ( 0, i*3+2, width()-1, i*3+2 ); } painter.end ( ); setBackgroundPixmap ( bg ); break; } case TabConfig::SolidColor: { setBackgroundPixmap ( QPixmap ( )); if ( val. isEmpty ( )) setBackgroundColor ( colorGroup ( ). base ( )); else setBackgroundColor ( val ); break; } case TabConfig::Image: { - qDebug( "Loading image: %s", val.latin1() ); + odebug << "Loading image: " << val << "" << oendl; QPixmap bg ( Resource::loadPixmap ( "wallpaper/" + val )); if ( bg. isNull ( )) { QImageIO imgio; imgio. setFileName ( val ); QSize ds = qApp-> desktop ( )-> size ( ); QString param ( "Scale( %1, %2, ScaleMin )" ); // No tr imgio. setParameters ( param. arg ( ds. width ( )). arg ( ds. height ( )). latin1 ( )); imgio. read ( ); bg = imgio. image ( ); } setBackgroundPixmap ( bg ); break; } } m_bgtype = t; viewport ( )-> update ( ); } void setTextColor ( const QColor &tc ) { m_textcolor = tc; QColorGroup cg = colorGroup ( ); cg. setColor ( QColorGroup::Text, tc ); setPalette ( QPalette ( cg, cg, cg )); viewport ( )-> update ( ); } void setViewFont ( const QFont &f ) { setFont ( f ); } diff --git a/core/settings/launcher/taskbarsettings.cpp b/core/settings/launcher/taskbarsettings.cpp index 43886c9..8dd9e97 100644 --- a/core/settings/launcher/taskbarsettings.cpp +++ b/core/settings/launcher/taskbarsettings.cpp @@ -1,164 +1,168 @@ /* 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 "taskbarsettings.h" +/* OPIE */ #include <qpe/config.h> #include <qpe/qlibrary.h> #include <qpe/qpeapplication.h> #include <qpe/taskbarappletinterface.h> #include <qpe/qcopenvelope_qws.h> +#include <opie2/odebug.h> +/* QT */ #include <qdir.h> #include <qlistview.h> #include <qheader.h> #include <qlayout.h> #include <qlabel.h> #include <qwhatsthis.h> +/* STD */ #include <stdlib.h> TaskbarSettings::TaskbarSettings ( QWidget *parent, const char *name ) : QWidget ( parent, name ) { m_applets_changed = false; QBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); QLabel *l = new QLabel ( tr( "Load applets in Taskbar:" ), this ); lay-> addWidget ( l ); m_list = new QListView ( this ); m_list-> addColumn ( "foobar" ); m_list-> header ( )-> hide ( ); lay-> addWidget ( m_list ); QWhatsThis::add ( m_list, tr( "Check the applets that you want displayed in the Taskbar." )); connect ( m_list, SIGNAL( clicked(QListViewItem*)), this, SLOT( appletChanged())); init ( ); } void TaskbarSettings::init ( ) { Config cfg ( "Taskbar" ); cfg. setGroup ( "Applets" ); QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' ); QString path = QPEApplication::qpeDir ( ) + "/plugins/applets"; #ifdef Q_OS_MACX QStringList list = QDir ( path, "lib*.dylib" ). entryList ( ); #else QStringList list = QDir ( path, "lib*.so" ). entryList ( ); #endif /* Q_OS_MACX */ for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) { QString name; QPixmap icon; TaskbarNamedAppletInterface *iface = 0; - qWarning("Load applet: %s", (*it).latin1() ); + owarn << "Load applet: " << (*it) << "" << oendl; QLibrary *lib = new QLibrary ( path + "/" + *it ); lib-> queryInterface ( IID_TaskbarNamedApplet, (QUnknownInterface**) &iface ); - qWarning("<1>"); + owarn << "<1>" << oendl; if ( iface ) { - qWarning("<2>"); + owarn << "<2>" << oendl; QString lang = getenv( "LANG" ); QTranslator *trans = new QTranslator ( qApp ); QString type = (*it). left ((*it). find (".")); QString tfn = QPEApplication::qpeDir ( ) + "/i18n/" + lang + "/" + type + ".qm"; if ( trans-> load ( tfn )) qApp-> installTranslator ( trans ); else delete trans; name = iface-> name ( ); icon = iface-> icon ( ); iface-> release ( ); } - qWarning("<3>"); + owarn << "<3>" << oendl; if ( !iface ) { - qWarning("<4>"); + owarn << "<4>" << oendl; lib-> queryInterface ( IID_TaskbarApplet, (QUnknownInterface**) &iface ); if ( iface ) { - qWarning("<5>"); + owarn << "<5>" << oendl; name = (*it). mid ( 3 ); - qWarning("Found applet: %s", name.latin1() ); + owarn << "Found applet: " << name << "" << oendl; #ifdef Q_OS_MACX int sep = name. find( ".dylib" ); #else int sep = name. find( ".so" ); #endif /* Q_OS_MACX */ if ( sep > 0 ) name. truncate ( sep ); sep = name. find ( "applet" ); if ( sep == (int) name.length ( ) - 6 ) name. truncate ( sep ); name[0] = name[0]. upper ( ); iface-> release ( ); } } - qWarning("<6>"); + owarn << "<6>" << oendl; if ( iface ) { - qWarning("<7>"); + owarn << "<7>" << oendl; QCheckListItem *item; item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox ); if ( !icon. isNull ( )) item-> setPixmap ( 0, icon ); item-> setOn ( exclude. find ( *it ) == exclude. end ( )); m_applets [*it] = item; } lib-> unload ( ); delete lib; } } void TaskbarSettings::appletChanged() { m_applets_changed = true; } void TaskbarSettings::accept ( ) { Config cfg ( "Taskbar" ); cfg. setGroup ( "Applets" ); if ( m_applets_changed ) { QStringList exclude; QMap <QString, QCheckListItem *>::Iterator it; for ( it = m_applets. begin ( ); it != m_applets. end ( ); ++it ) { if ( !(*it)-> isOn ( )) exclude << it. key ( ); } cfg. writeEntry ( "ExcludeApplets", exclude, ',' ); } cfg. writeEntry ( "SafeMode", false ); diff --git a/core/settings/light-and-power/light.cpp b/core/settings/light-and-power/light.cpp index d64a063..424a64c 100644 --- a/core/settings/light-and-power/light.cpp +++ b/core/settings/light-and-power/light.cpp @@ -1,71 +1,74 @@ /* This file is part of the OPIE Project =. Copyright (c) 2002 Maximilian Reiss <harlekin@handhelds.org> .=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 "light.h" #include "sensor.h" +/* OPIE */ #include <opie2/odevice.h> +#include <opie2/odebug.h> #include <qpe/config.h> #include <qpe/power.h> #if defined(Q_WS_QWS) && !defined(QT_NO_COP) #include <qpe/qcopenvelope_qws.h> #endif +/* QT */ #include <qlabel.h> #include <qcheckbox.h> #include <qtabwidget.h> #include <qslider.h> #include <qspinbox.h> #include <qpushbutton.h> #include <qgroupbox.h> #include <qcombobox.h> using namespace Opie::Core; LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) : LightSettingsBase( parent, name, false, WStyle_ContextHelp ) { m_bres = ODevice::inst ( )-> displayBrightnessResolution ( ); m_cres = ODevice::inst ( )-> displayContrastResolution ( ); // check whether to show the light sensor stuff if ( !ODevice::inst ( )-> hasLightSensor ( )) { auto_brightness-> hide ( ); CalibrateLightSensor-> hide ( ); auto_brightness_ac-> hide ( ); CalibrateLightSensor_ac-> hide ( ); } // check whether to show the contrast stuff if (m_cres) { GroupLight->setTitle(tr("Backlight && Contrast")); @@ -204,77 +207,77 @@ void LightSettings::calibrateSensor ( ) connect ( s, SIGNAL( viewBacklight(int)), this, SLOT( setBacklight(int))); QPEApplication::execDialog( s ); delete s; } void LightSettings::calibrateSensorAC ( ) { Sensor *s = new Sensor ( m_sensordata_ac, this ); connect ( s, SIGNAL( viewBacklight(int)), this, SLOT( setBacklight(int))); QPEApplication::execDialog ( s ); delete s; } void LightSettings::setBacklight ( int bright ) { QCopEnvelope e ( "QPE/System", "setBacklight(int)" ); e << bright; if ( bright != -1 ) { m_resettimer-> stop ( ); m_resettimer-> start ( 4000, true ); } } void LightSettings::setContrast ( int contr ) { if (contr == -1) contr = m_oldcontrast; ODevice::inst ( )-> setDisplayContrast(contr); } void LightSettings::setFrequency ( int index ) { - qWarning("LightSettings::setFrequency(%d)", index); + owarn << "LightSettings::setFrequency(" << index << ")" << oendl; ODevice::inst ( )-> setCurrentCpuFrequency(index); } void LightSettings::resetBacklight ( ) { setBacklight ( -1 ); setContrast ( -1 ); } void LightSettings::setCloseHingeAction ( int index ) { - qWarning("LightSettings::setCloseHingeStatus(%d)", index); + owarn << "LightSettings::setCloseHingeStatus(" << index << ")" << oendl; } void LightSettings::accept ( ) { Config config ( "apm" ); // bat config. setGroup ( "Battery" ); config. writeEntry ( "LcdOffOnly", LcdOffOnly-> isChecked ( )); config. writeEntry ( "Dim", interval_dim-> value ( )); config. writeEntry ( "LightOff", interval_lightoff-> value ( )); config. writeEntry ( "Suspend", interval_suspend-> value ( )); config. writeEntry ( "Brightness", brightness-> value () ); if (m_cres) config. writeEntry ( "Contrast", contrast-> value () ); config. writeEntry ( "Freq", frequency->currentItem() ); config. writeEntry ( "CloseHingeAction", closeHingeAction->currentItem() ); // ac config. setGroup ( "AC" ); config. writeEntry ( "LcdOffOnly", LcdOffOnly_ac-> isChecked ( )); config. writeEntry ( "Dim", interval_dim_ac-> value ( )); config. writeEntry ( "LightOff", interval_lightoff_ac-> value ( )); config. writeEntry ( "Suspend", interval_suspend_ac-> value ( )); config. writeEntry ( "Brightness", brightness_ac-> value () ); if (m_cres) config. writeEntry ( "Contrast", contrast_ac-> value () ); config. writeEntry ( "Freq", frequency_ac->currentItem() ); config. writeEntry ( "CloseHingeAction", closeHingeAction_ac->currentItem() ); // only make light sensor stuff appear if the unit has a sensor if ( ODevice::inst ( )-> hasLightSensor ( )) { diff --git a/core/settings/security/security.cpp b/core/settings/security/security.cpp index 4eddb55..b917aea 100644 --- a/core/settings/security/security.cpp +++ b/core/settings/security/security.cpp @@ -1,66 +1,72 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of Qtopia Environment. ** ** 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. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "security.h" +/* OPIE */ #include <qpe/qpeapplication.h> #include <qpe/config.h> #include <qpe/password.h> #include <qpe/qpedialog.h> #include <qpe/qcopenvelope_qws.h> +#include <opie2/odebug.h> +/* QT */ #include <qcheckbox.h> #include <qpushbutton.h> #include <qcombobox.h> #include <qmessagebox.h> #include <qfile.h> #include <qtextstream.h> + +using namespace Opie::Core; + Security::Security( QWidget* parent, const char* name, WFlags fl ) : SecurityBase( parent, name, TRUE, WStyle_ContextHelp ) { valid=FALSE; Config cfg("Security"); cfg.setGroup("Passcode"); passcode = cfg.readEntry("passcode"); passcode_poweron->setChecked(cfg.readBoolEntry("passcode_poweron",FALSE)); cfg.setGroup("Sync"); int auth_peer = cfg.readNumEntry("auth_peer",0xc0a88100);//new default 192.168.129.0/24 int auth_peer_bits = cfg.readNumEntry("auth_peer_bits",24); selectNet(auth_peer,auth_peer_bits,TRUE); connect(syncnet, SIGNAL(textChanged(const QString&)), this, SLOT(setSyncNet(const QString&))); /* cfg.setGroup("Remote"); if ( telnetAvailable() ) telnet->setChecked(cfg.readEntry("allow_telnet")); else telnet->hide(); if ( sshAvailable() ) ssh->setChecked(cfg.readEntry("allow_ssh")); else ssh->hide(); */ QString configFile = QPEApplication::qpeDir() + "/etc/opie-login.conf"; @@ -228,65 +234,65 @@ void Security::selectNet(int auth_peer,int auth_peer_bits, bool update) insertDefaultRanges(); } else { // 10 ought to be enough for everybody... :) // If you need more, don't forget to edit applySecurity() as well bool already_there=FALSE; for (int i=0; i<10; i++) { QString target, netrange; target.sprintf("net%d", i); netrange = cfg.readEntry(target,""); if (! netrange.isEmpty()){ //make sure we have no "twin" entries for (int i=0; i<syncnet->count(); i++) { if ( syncnet->text(i) == netrange ) { already_there=TRUE; } } if (! already_there) { syncnet->insertItem( tr( netrange ) ); } else { already_there=FALSE; } } } } } for (int i=0; i<syncnet->count(); i++) { if ( syncnet->text(i).left(sn.length()) == sn ) { syncnet->setCurrentItem(i); return; } } - qDebug("No match for \"%s\"",sn.latin1()); + odebug << "No match for \"" << sn << "\"" << oendl; } void Security::parseNet(const QString& sn,int& auth_peer,int& auth_peer_bits) { auth_peer=0; if ( sn == tr("Any") ) { auth_peer = 0; auth_peer_bits = 0; } else if ( sn == tr("None") ) { auth_peer = 0; auth_peer_bits = 32; } else { int x=0; for (int i=0; i<4; i++) { int nx = sn.find(QChar(i==3 ? '/' : '.'),x); auth_peer = (auth_peer<<8)|sn.mid(x,nx-x).toInt(); x = nx+1; } uint n = (uint)sn.find(' ',x)-x; auth_peer_bits = sn.mid(x,n).toInt(); } } void Security::loadUsers ( void ) { QFile passwd("/etc/passwd"); if ( passwd.open(IO_ReadOnly) ) { QTextStream t( &passwd ); QString s; QStringList account; while ( !t.eof() ) { account = QStringList::split(':',t.readLine()); diff --git a/core/settings/security/security.pro b/core/settings/security/security.pro index 4a29ee2..4c1e68b 100644 --- a/core/settings/security/security.pro +++ b/core/settings/security/security.pro @@ -1,10 +1,10 @@ CONFIG += qt warn_on quick-app HEADERS = security.h SOURCES = security.cpp main.cpp INTERFACES = securitybase.ui INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += ../$(OPIEDIR)/include -LIBS += -lqpe +LIBS += -lqpe -lopiecore2 TARGET = security include ( $(OPIEDIR)/include.pro ) diff --git a/core/symlinker/main.cpp b/core/symlinker/main.cpp index 6a04980..96e7f3c 100644 --- a/core/symlinker/main.cpp +++ b/core/symlinker/main.cpp @@ -1,179 +1,185 @@ + +/* OPIE */ +#include <opie2/odebug.h> + +/* QT */ #include <qapplication.h> #include <qfile.h> #include <qfileinfo.h> #include <qdir.h> #include <qtextstream.h> #include <qstringlist.h> +/* STD */ #include <stdlib.h> #include <unistd.h> //symlink() #include <sys/stat.h> // mkdir() #include <sys/vfs.h> #include <mntent.h> #include <errno.h> static const char *listDir = "/usr/lib/ipkg/externinfo/"; static void createSymlinks( const QString &location, const QString &package ) { QFile inFile( location + "/usr/lib/ipkg/info/" + package + ".list" ); mkdir( "/usr/lib/ipkg", 0777 ); mkdir( listDir, 0777 ); QFile outFile( listDir + package + ".list"); -// qDebug( "createSymlinks %s -> %s", inFile.name().ascii(), outFile.name().ascii() ); +// odebug << "createSymlinks " << inFile.name().ascii() << " -> " << outFile.name().ascii() << "" << oendl; if ( inFile.open(IO_ReadOnly) && outFile.open(IO_WriteOnly)) { QTextStream in(&inFile); QTextStream out(&outFile); QString s; while ( !in.eof() ) { // until end of file... s = in.readLine(); // line of text excluding '\n' -// qDebug( "Read: %s", s.ascii() ); +// odebug << "Read: " << s.ascii() << "" << oendl; if (s.find(location,0,true) >= 0){ -// qDebug( "Found!" ); +// odebug << "Found!" << oendl; s = s.replace(location,""); } -// qDebug( "Read after: %s", s.ascii() ); +// odebug << "Read after: " << s.ascii() << "" << oendl; // for s, do link/mkdir. if ( s.right(1) == "/" ) { -// qDebug("do mkdir for %s", s.ascii()); +// odebug << "do mkdir for " << s.ascii() << "" << oendl; mkdir( s.ascii(), 0777 ); //possible optimization: symlink directories //that don't exist already. -- Risky. } else { -// qDebug("do symlink for %s", s.ascii()); +// odebug << "do symlink for " << s.ascii() << "" << oendl; QFileInfo ffi( s ); //Don't try to symlink if a regular file exists already if ( !ffi.exists() || ffi.isSymLink() ) { if (symlink( (location+s).ascii(), s.ascii() ) != 0){ if (errno == ENOENT){ // perror("Symlink Failed! "); QString e=s.ascii(); e = e.replace(ffi.fileName(),""); -// qDebug("DirName : %s",e.ascii() ); +// odebug << "DirName : " << e.ascii() << "" << oendl; system ( QString("mkdir -p ")+e.ascii() ); if (symlink( (location+s).ascii(), s.ascii() ) != 0) - qDebug ("Big problem creating symlink and directory"); + odebug << "Big problem creating symlink and directory" << oendl; } } // qDebug ( "Created %s" ,s.ascii() ); out << s << "\n"; } else { - qDebug( "%s exists already, not symlinked", s.ascii() ); + odebug << "" << s.ascii() << " exists already, not symlinked" << oendl; } } } inFile.close(); outFile.close(); } } static void removeSymlinks( const QString &package ) { QFile inFile( listDir + package + ".list" ); if ( inFile.open(IO_ReadOnly) ) { QTextStream in(&inFile); QString s; while ( !in.eof() ) { // until end of file... s = in.readLine(); // line of text excluding '\n' -// qDebug("remove symlink %s", s.ascii()); +// odebug << "remove symlink " << s.ascii() << "" << oendl; QFileInfo ffi( s ); //Confirm that it's still a symlink. if ( ffi.isSymLink() ){ unlink( s.ascii() ); // qDebug ( "Removed %s", s.ascii() );} // else -// qDebug( "Not removed %s", s.ascii() ); +// odebug << "Not removed " << s.ascii() << "" << oendl; } } inFile.close(); inFile.remove(); } } /* Slightly hacky: we can't use StorageInfo, since we don't have a QApplication. We look for filesystems that have the directory /usr/lib/ipkg/info, and assume that they are removable media with packages installed. This is safe even if eg. /usr is on a separate filesystem, since then we would be testing for /usr/usr/lib/ipkg/info, which should not exist. (And if it does they deserve to have it treated as removable.) */ static void updateSymlinks() { QDir lists( listDir ); QStringList knownPackages = lists.entryList( "*.list" ); // No tr struct mntent *me; FILE *mntfp = setmntent( "/etc/mtab", "r" ); if ( mntfp ) { while ( (me = getmntent( mntfp )) != 0 ) { QString root = me->mnt_dir; if ( root == "/" ) continue; QString info = root + "/usr/lib/ipkg/info"; QDir infoDir( info ); -// qDebug( "looking at %s", info.ascii() ); +// odebug << "looking at " << info.ascii() << "" << oendl; if ( infoDir.isReadable() ) { const QFileInfoList *packages = infoDir.entryInfoList( "*.list" ); // No tr QFileInfoListIterator it( *packages ); QFileInfo *fi; while (( fi = *it )) { ++it; if ( knownPackages.contains( fi->fileName() ) ) { -// qDebug( "found %s and we've seen it before", fi->fileName().latin1() ); +// odebug << "found " << fi->fileName() << " and we've seen it before" << oendl; knownPackages.remove( fi->fileName() ); } else { //it's a new one createSymlinks( root, fi->baseName() ); } } } } endmntent( mntfp ); } for ( QStringList::Iterator it = knownPackages.begin(); it != knownPackages.end(); ++it ) { // strip ".info" off the end. removeSymlinks( (*it).left((*it).length()-5) ); } } int main( int argc, char *argv[] ) { QApplication a( argc, argv, QApplication::Tty ); QString command = argc > 1 ? argv[1] : "update"; // No tr if ( command == "update" ) // No tr updateSymlinks(); else if ( command == "create" && argc > 3 ) // No tr createSymlinks( argv[2], argv[3] ); else if ( command == "remove" && argc > 2 ) // No tr removeSymlinks( argv[2] ); else - qWarning( "Argument error" ); + owarn << "Argument error" << oendl; } diff --git a/core/symlinker/symlinker.pro b/core/symlinker/symlinker.pro index f850d46..50ad785 100644 --- a/core/symlinker/symlinker.pro +++ b/core/symlinker/symlinker.pro @@ -1,15 +1,15 @@ TEMPLATE = app CONFIG += qt warn_on DESTDIR = $(OPIEDIR)/bin HEADERS = SOURCES = main.cpp INTERFACES = TARGET = opie-update-symlinks INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include . -LIBS += -lqpe +LIBS += -lqpe -lopiecore2 include ( $(OPIEDIR)/include.pro ) diff --git a/core/tools/quicklauncher/main.cpp b/core/tools/quicklauncher/main.cpp index d467d6e..c2467fb 100644 --- a/core/tools/quicklauncher/main.cpp +++ b/core/tools/quicklauncher/main.cpp @@ -1,72 +1,79 @@ /********************************************************************** ** Copyright (C) 2000-2003 Trolltech AS. All rights reserved. ** ** This file is part of the Qtopia Environment. ** ** 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. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ +#include "dropins.h" + +/* OPIE */ +#include <opie2/odebug.h> + +/* QT */ #include <qpainter.h> #include <qstrlist.h> #include <qtimer.h> #include <qguardedptr.h> #include <qcopchannel_qws.h> #define QTOPIA_INTERNAL_INITAPP #ifdef private # undef private #endif #define private public #include <qtopia/qpeapplication.h> #undef private + +/* STD */ #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> -#include "dropins.h" using QuickPrivate::PluginLoader; static QPEApplication *app = 0; static PluginLoader *loader = 0; static ApplicationInterface *appIface = 0; static QGuardedPtr<QWidget> mainWindow; #ifdef _OS_LINUX_ static char **argv0 = 0; static int argv_lth; extern char **environ; #ifndef SPT_BUFSIZE #define SPT_BUFSIZE 2048 #endif #include <stdarg.h> using namespace Opie::Ui; void setproctitle (const char *fmt,...) { int i; char buf[SPT_BUFSIZE]; va_list ap; if (!argv0) return; va_start(ap, fmt); (void) vsnprintf(buf, SPT_BUFSIZE, fmt, ap); va_end(ap); i = strlen (buf); if (i > argv_lth - 2) { i = argv_lth - 2; @@ -82,160 +89,160 @@ void setproctitle (const char *fmt,...) { class QuickLauncher : public QObject { Q_OBJECT public: QuickLauncher() : QObject() { QCString ch("QPE/QuickLauncher-"); ch += QString::number(getpid()); qlChannel = new QCopChannel( ch, this); connect( qlChannel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(message(const QCString&,const QByteArray&)) ); } static void exec( int /*argc*/, char **argv ) { QString appName = argv[0]; int sep = appName.findRev( '/' ); if ( sep > 0 ) appName = appName.mid( sep+1 ); appIface = 0; if ( loader->queryInterface(appName, IID_QtopiaApplication, (QUnknownInterface**)&appIface) == QS_OK ) { mainWindow = appIface->createMainWindow( appName ); } if ( mainWindow ) { if ( mainWindow->metaObject()->slotNames().contains("setDocument(const QString&)") ) { app->showMainDocumentWidget( mainWindow ); } else { app->showMainWidget( mainWindow ); } } else { - qWarning( "Could not create application main window" ); + owarn << "Could not create application main window" << oendl; exit(-1); } } private slots: void message(const QCString &msg, const QByteArray & data) { QStrList argList; if ( msg == "execute(QStrList)" ) { delete qlChannel; QDataStream stream( data, IO_ReadOnly ); QStrList argList; stream >> argList; - qDebug( "QuickLauncher execute: %s", argList.at(0) ); + odebug << "QuickLauncher execute: " << argList.at(0) << "" << oendl; doQuickLaunch( argList ); delete this; } else if ( msg == "execute(QString)" ) { delete qlChannel; QDataStream stream( data, IO_ReadOnly ); QString arg; stream >> arg; - qDebug( "QuickLauncher execute: %s", arg.latin1() ); + odebug << "QuickLauncher execute: " << arg << "" << oendl; QStrList argList; argList.append( arg.utf8() ); doQuickLaunch( argList ); delete this; } } private: void doQuickLaunch( QStrList &argList ) { static int myargc = argList.count(); static char **myargv = new char *[myargc + 1]; for ( int j = 0; j < myargc; j++ ) { myargv[j] = new char [strlen(argList.at(j))+1]; strcpy( myargv[j], argList.at(j) ); } myargv[myargc] = NULL; #ifdef _OS_LINUX_ // Change name of process setproctitle(myargv[0]); #endif connect(app, SIGNAL(lastWindowClosed()), app, SLOT(hideOrQuit())); app->exit_loop(); app->initApp( myargc, myargv ); exec( myargc, myargv ); } private: QCopChannel *qlChannel; }; int main( int argc, char** argv ) { app = new QPEApplication( argc, argv ); loader = new PluginLoader( "application" ); unsetenv( "LD_BIND_NOW" ); QCString arg0 = argv[0]; int sep = arg0.findRev( '/' ); if ( sep > 0 ) arg0 = arg0.mid( sep+1 ); if ( arg0 != "quicklauncher" ) { - qDebug( "QuickLauncher invoked as: %s", arg0.data() ); + odebug << "QuickLauncher invoked as: " << arg0.data() << "" << oendl; QuickLauncher::exec( argc, argv ); } else { #ifdef _OS_LINUX_ // Setup to change proc title int i; char **envp = environ; /* Move the environment so we can reuse the memory. * (Code borrowed from sendmail.) */ for (i = 0; envp[i] != NULL; i++) continue; environ = (char **) malloc(sizeof(char *) * (i + 1)); if (environ == NULL) return -1; for (i = 0; envp[i] != NULL; i++) if ((environ[i] = strdup(envp[i])) == NULL) return -1; environ[i] = NULL; argv0 = argv; if (i > 0) argv_lth = envp[i-1] + strlen(envp[i-1]) - argv0[0]; else argv_lth = argv0[argc-1] + strlen(argv0[argc-1]) - argv0[0]; #endif (void)new QuickLauncher(); - qDebug( "QuickLauncher running" ); + odebug << "QuickLauncher running" << oendl; // Pre-load default fonts QFontMetrics fm( QApplication::font() ); fm.ascent(); // causes font load. QFont f( QApplication::font() ); f.setWeight( QFont::Bold ); QFontMetrics fmb( f ); fmb.ascent(); // causes font load. // Each of the following force internal structures/internal // initialization to be performed. This may mean allocating // memory that is not needed by all applications. #if 0 TimeZone::current().isValid(); // popuplate timezone cache TimeString::currentDateFormat(); // create internal structures TimeString::currentAMPM(); #endif Resource::loadIconSet("new"); // do internal init /* make sure libopie gets lined in */ { Opie::Ui::OWait item; } // Create a widget to force initialization of title bar images, etc. QObject::disconnect(app, SIGNAL(lastWindowClosed()), app, SLOT(hideOrQuit())); QWidget *w = new QWidget(0,0,Qt::WDestructiveClose|Qt::WStyle_ContextHelp|Qt::WStyle_Tool); w->setGeometry( -100, -100, 10, 10 ); w->show(); QTimer::singleShot( 0, w, SLOT(close()) ); app->enter_loop(); } |