-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,155 +1,161 @@ + +#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 ); } private: QString m_key; bool m_def; }; RemapDlg::RemapDlg ( const Opie::Core::ODeviceButton *b, bool hold, QWidget *parent, const char *name ) : RemapDlgBase ( parent, name, true, WStyle_ContextHelp ) { setCaption ( tr( "%1 %2", "(hold|press) buttoname" ). arg( hold ? tr( "Held" ) : tr( "Pressed" )). arg ( b-> userText ( ))); m_current = 0; static const char * const def_channels [] = { "QPE/Application/", "QPE/Launcher", "QPE/System", "QPE/TaskBar", "QPE/", 0 }; w_channel-> insertStrList ((const char **) def_channels ); m_msg = hold ? b-> heldAction ( ) : b-> pressedAction ( ); m_msg_preset = hold ? b-> factoryPresetHeldAction ( ) : b-> factoryPresetPressedAction ( ); m_map_none = new NoSortItem ( w_list, 0, tr( "No mapping" )); m_map_preset = new NoSortItem ( w_list, 1, tr( "Default" ), m_msg_preset. channel ( ), m_msg_preset. message ( )); ((NoSortItem *) m_map_preset )-> setDefault ( true ); if (m_msg. channel ( ) == "ignore") { m_map_custom = new NoSortItem ( w_list, 2, tr( "Custom" ), m_msg_preset. channel ( ), m_msg_preset. message ( )); m_current = m_map_none; } else { m_map_custom = new NoSortItem ( w_list, 2, tr( "Custom" ), m_msg. channel ( ), m_msg. message ( )); m_current = m_map_custom; } QListViewItem *it = new NoSortItem ( w_list, 3, tr( "Actions" )); ButtonUtils::inst ( )-> insertActions ( it ); it-> setOpen ( true ); m_map_show = new NoSortItem ( w_list, 4, tr( "Show" )); 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()); return m_msg; } 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,145 +1,149 @@ /********************************************************************** ** 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 ); listTimes.append( lblCTime4 ); listTimes.append( lblCTime5 ); listTimes.append( lblCTime6 ); lblCTime7->hide(); lblCTime8->hide(); lblCTime9->hide(); cmdCity7->hide(); cmdCity8->hide(); cmdCity9->hide(); } else { listCities.append( cmdCity7 ); listCities.append( cmdCity8 ); listCities.append( cmdCity9 ); listTimes.append( lblCTime7 ); listTimes.append( lblCTime8 ); listTimes.append( lblCTime9 ); lblCTime4->hide(); lblCTime5->hide(); lblCTime6->hide(); cmdCity4->hide(); cmdCity5->hide(); cmdCity6->hide(); } selWidget = frmMap->selectionWidget( this ); selWidget->hide(); CityTimeBaseLayout->addWidget( selWidget ); bAdded = true; readInTimes(); changed = FALSE; QObject::connect( qApp, SIGNAL( clockChanged(bool) ), this, SLOT( changeClock(bool) ) ); // now start the timer so we can update the time quickly every second timerEvent( 0 ); } CityTime::~CityTime() { if ( changed ) { Config cfg("CityTime"); cfg.setGroup("TimeZones"); QListIterator<QToolButton> itCity( listCities ); int i; bool realTzWritten = FALSE; for ( i = 0, itCity.toFirst(); i < CITIES; i++, ++itCity ) { if ( !strCityTz[i].isNull() ) { cfg.writeEntry("Zone"+QString::number(i), strCityTz[i]); cfg.writeEntry("ZoneName"+QString::number(i), itCity.current()->text()); if ( strCityTz[i] == strRealTz ) realTzWritten = TRUE; } } if ( realTzWritten ) { cfg.removeEntry("Zone"+QString::number(CITIES)); cfg.removeEntry("ZoneName"+QString::number(CITIES)); } else { cfg.writeEntry("Zone"+QString::number(CITIES), strRealTz); if ( nameRealTz.isEmpty() ) { int i = strRealTz.find( '/' ); nameRealTz = strRealTz.mid( i+1 ); } cfg.writeEntry("ZoneName"+QString::number(CITIES), nameRealTz); } QCopEnvelope ( "QPE/System", "timeZoneListChange()" ); 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,105 +1,109 @@ // 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 ); cmdCity7->setFont( cmdCity7_font ); cmdCity7->setFocusPolicy( QToolButton::TabFocus ); cmdCity7->setText( tr( "" ) ); cmdCity7->setToggleButton( TRUE ); cmdCity7->setToggleButton( TRUE ); Layout2->addWidget( cmdCity7, 0, 2 ); lblCTime9 = new QLabel( buttonWidget, "lblCTime9" ); lblCTime9->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, lblCTime9->sizePolicy().hasHeightForWidth() ) ); QFont lblCTime9_font( lblCTime9->font() ); lblCTime9_font.setPointSize( 10 ); lblCTime9->setFont( lblCTime9_font ); lblCTime9->setText( tr( "" ) ); lblCTime9->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); Layout2->addWidget( lblCTime9, 2, 3 ); cmdCity8 = new QToolButton( buttonWidget, "cmdCity8" ); cmdCity8->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity8->sizePolicy().hasHeightForWidth() ) ); QFont cmdCity8_font( cmdCity8->font() ); cmdCity8_font.setBold( TRUE ); cmdCity8->setFont( cmdCity8_font ); cmdCity8->setFocusPolicy( QToolButton::TabFocus ); cmdCity8->setText( tr( "" ) ); cmdCity8->setToggleButton( TRUE ); cmdCity8->setToggleButton( TRUE ); Layout2->addWidget( cmdCity8, 1, 2 ); cmdCity2 = new QToolButton( buttonWidget, "cmdCity2" ); QFont cmdCity2_font( cmdCity2->font() ); cmdCity2_font.setBold( TRUE ); cmdCity2->setFont( cmdCity2_font ); cmdCity2->setFocusPolicy( QToolButton::TabFocus ); cmdCity2->setText( tr( "" ) ); cmdCity2->setToggleButton( TRUE ); cmdCity2->setToggleButton( TRUE ); Layout2->addWidget( cmdCity2, 1, 0 ); lblCTime6 = new QLabel( buttonWidget, "lblCTime6" ); QFont lblCTime6_font( lblCTime6->font() ); lblCTime6_font.setPointSize( 10 ); lblCTime6->setFont( lblCTime6_font ); lblCTime6->setText( tr( "" ) ); lblCTime6->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); Layout2->addWidget( lblCTime6, 5, 1 ); cmdCity6 = new QToolButton( buttonWidget, "cmdCity6" ); cmdCity6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity6->sizePolicy().hasHeightForWidth() ) ); QFont cmdCity6_font( cmdCity6->font() ); cmdCity6_font.setBold( TRUE ); cmdCity6->setFont( cmdCity6_font ); cmdCity6->setFocusPolicy( QToolButton::TabFocus ); cmdCity6->setText( tr( "" ) ); cmdCity6->setToggleButton( TRUE ); cmdCity6->setToggleButton( TRUE ); Layout2->addWidget( cmdCity6, 5, 0 ); cmdCity4 = new QToolButton( buttonWidget, "cmdCity4" ); cmdCity4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity4->sizePolicy().hasHeightForWidth() ) ); @@ -308,104 +312,104 @@ CityTimeBase::CityTimeBase( QWidget* parent, const char* name, WFlags ) connect( cmdCity7, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) ); connect( cmdCity3, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) ); connect( cmdCity4, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) ); connect( cmdCity5, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) ); connect( cmdCity6, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) ); connect( cmdCity8, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) ); connect( cmdCity9, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) ); // tab order setTabOrder( cmdCity1, cmdCity2 ); setTabOrder( cmdCity2, cmdCity3 ); setTabOrder( cmdCity3, cmdCity4 ); setTabOrder( cmdCity4, cmdCity5 ); setTabOrder( cmdCity5, cmdCity6 ); setTabOrder( cmdCity6, cmdCity7 ); setTabOrder( cmdCity7, cmdCity8 ); setTabOrder( cmdCity8, cmdCity9 ); setTabOrder( cmdCity9, frmMap ); } /* * Destroys the object and frees any allocated resources */ CityTimeBase::~CityTimeBase() { // no need to delete child widgets, Qt does it all for us } /* * Main event handler. Reimplemented to handle application * font changes */ bool CityTimeBase::event( QEvent* ev ) { bool ret = QWidget::event( ev ); if ( ev->type() == QEvent::ApplicationFontChange ) { QFont cmdCity7_font( cmdCity7->font() ); cmdCity7_font.setBold( TRUE ); cmdCity7->setFont( cmdCity7_font ); QFont lblCTime9_font( lblCTime9->font() ); lblCTime9_font.setPointSize( 10 ); lblCTime9->setFont( lblCTime9_font ); QFont cmdCity8_font( cmdCity8->font() ); cmdCity8_font.setBold( TRUE ); cmdCity8->setFont( cmdCity8_font ); QFont cmdCity2_font( cmdCity2->font() ); cmdCity2_font.setBold( TRUE ); cmdCity2->setFont( cmdCity2_font ); QFont lblCTime6_font( lblCTime6->font() ); lblCTime6_font.setPointSize( 10 ); lblCTime6->setFont( lblCTime6_font ); QFont cmdCity6_font( cmdCity6->font() ); cmdCity6_font.setBold( TRUE ); cmdCity6->setFont( cmdCity6_font ); QFont cmdCity4_font( cmdCity4->font() ); cmdCity4_font.setBold( TRUE ); cmdCity4->setFont( cmdCity4_font ); QFont lblCTime5_font( lblCTime5->font() ); lblCTime5_font.setPointSize( 10 ); lblCTime5->setFont( lblCTime5_font ); QFont lblCTime2_font( lblCTime2->font() ); lblCTime2_font.setPointSize( 10 ); lblCTime2->setFont( lblCTime2_font ); QFont lblCTime1_font( lblCTime1->font() ); 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,232 +1,236 @@ /********************************************************************** ** 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; QString strTmp; // we should be able to assume that the country code is always the first // two chars, so just grap them and let it go... strCountryCode = strLine.left( 2 ); iStart = regCoord.match( strLine, 0, &iLen ); if ( iStart >= 0 ) { strTmp = strLine.mid( iStart, iLen ); tmp = strTmp.toInt(); // okay, there are two versions of the format, make a decision based on // the size... // Oh BTW, we are storing everything in seconds! if ( iLen < 7 ) { _y = tmp / 100; _y *= 60; _y += tmp % 100; _y *= 60; } else { _y = tmp / 10000; _y *= 60; tmp %= 10000; _y += tmp / 100; _y *= 60; tmp %= 100; _y += tmp; } } iStart = regCoord.match( strLine, iStart + iLen, &iLen ); if ( iStart >= 0 ) { strTmp = strLine.mid( iStart, iLen ); 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() ); // probably don't need this, but just in case... cmdZoom->move( width() - cmdZoom->width(), height() - cmdZoom->height() ); lblCity = new QLabel( tr( "CITY" ), this, "City Label" ); lblCity->setMinimumSize( lblCity->sizeHint() ); lblCity->setFrameStyle( QFrame::Plain | QFrame::Box ); lblCity->setBackgroundColor( yellow ); lblCity->hide(); // A timer to make sure the label gets hidden tHide = new QTimer( this, "Label Timer" ); QObject::connect( tHide, SIGNAL( timeout() ), lblCity, SLOT( hide() ) ); QObject::connect( tHide, SIGNAL( timeout() ), this, SLOT( slotRedraw() ) ); QTimer *tUpdate = new QTimer( this, "Update Timer" ); QObject::connect( tUpdate, SIGNAL( timeout() ), this, SLOT( slotUpdate() ) ); QObject::connect( qApp, SIGNAL( timeChanged() ), this, SLOT( slotUpdate() ) ); QObject::connect( cmdZoom, SIGNAL( toggled(bool) ), this, SLOT( slotZoom(bool) ) ); QObject::connect( &norm, SIGNAL( signalNewPoint(const QPoint&) ), this, SLOT( slotFindCity(const QPoint&) ) ); QObject::connect( qApp, SIGNAL( clockChanged(bool) ), this, SLOT( changeClock(bool) ) ); // update the sun's movement every 5 minutes tUpdate->start( 5 * 60 * 1000 ); // May as well read in the timezone information too... readZones(); } ZoneMap::~ZoneMap() { } void ZoneMap::readZones( void ) { QFile fZone( strZONEINFO ); if ( !fZone.open( IO_ReadOnly ) ) { QMessageBox::warning (this, tr( "Unable to Find Timezone Info" ), tr( "<p>Unable to find any timezone information in %1" ) .arg( strZONEINFO )); exit(-1); } else { QTextStream tZone( &fZone ); while ( !tZone.atEnd() ) { QString strLine = tZone.readLine(); // only pass on lines that aren't comments if ( strLine[0] != '#' ) { zones.append( new ZoneField( strLine ) ); } } fZone.close(); } } void ZoneMap::viewportMousePressEvent( QMouseEvent* event ) { // add the mouse event into the normalizer, and get the average, // pass it along slotRedraw(); 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,247 +1,249 @@ /* =. 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 ) { setItemsMovable ( false ); setAutoArrange ( true ); setSorting ( true ); setFrameStyle ( QFrame::NoFrame ); setSpacing ( 4 ); setMargin ( 0 ); setSelectionMode ( QIconView::NoSelection ); setBackgroundMode ( PaletteBase ); setViewMode ( TabConfig::Icon ); calculateGrid ( Bottom ); new SampleItem ( this, QObject::tr( "Sample 1" ), Resource::loadPixmap ( "datebook/DateBook" )); new SampleItem ( this, QObject::tr( "Sample 2" ), Resource::loadPixmap ( "Calibrate" )); new SampleItem ( this, QObject::tr( "Sample 3" ), Resource::loadPixmap ( "UnknownDocument" )); setBackgroundType ( TabConfig::Ruled, QString::null ); setMaximumHeight ( firstItem ( )-> height ( ) + 16 ); } void setViewMode ( TabConfig::ViewMode m ) { viewport ( )-> setUpdatesEnabled ( false ); switch ( m ) { case TabConfig::List: setItemTextPos( QIconView::Right ); break; case TabConfig::Icon: setItemTextPos( QIconView::Bottom ); break; } // hideOrShowItems ( false ); for ( QIconViewItem *it = firstItem ( ); it; it = it-> nextItem ( )) ((SampleItem *) it )-> sizeChange ( ); arrangeItemsInGrid ( true ); viewport ( )-> setUpdatesEnabled ( true ); 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 ); } void setItemTextPos ( ItemTextPos pos ) { calculateGrid ( pos ); QIconView::setItemTextPos( pos ); } void calculateGrid ( ItemTextPos pos ) { int dw = QApplication::desktop ( )-> width ( ); int viewerWidth = dw - style ( ).scrollBarExtent ( ). width ( ); if ( pos == Bottom ) { int cols = 3; if ( viewerWidth <= 200 ) cols = 2; else if ( viewerWidth >= 400 ) cols = viewerWidth/96; setSpacing ( 4 ); setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols ); setGridY ( fontMetrics ( ). height ( ) * 2 + 24 ); } else { int cols = 2; if ( viewerWidth < 150 ) cols = 1; else if ( viewerWidth >= 400 ) cols = viewerWidth / 150; setSpacing ( 2 ); setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols ); setGridY ( fontMetrics ( ). height ( ) + 2 ); } } void paletteChange( const QPalette &p ) { static bool excllock = false; if ( excllock ) return; excllock = true; unsetPalette ( ); QIconView::paletteChange ( p ); if ( m_bgtype == TabConfig::Ruled ) setBackgroundType ( TabConfig::Ruled, QString::null ); QColorGroup cg = colorGroup ( ); cg.setColor ( QColorGroup::Text, m_textcolor ); setPalette ( QPalette ( cg, cg, cg )); excllock = false; } void setBackgroundPixmap ( const QPixmap &pm ) { m_bgpix = pm; } void setBackgroundColor ( const QColor &c ) { m_bgcolor = c; } void drawBackground ( QPainter *p, const QRect &r ) { if ( !m_bgpix. isNull ( )) { 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,172 +1,176 @@ /* 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 ); cfg. write ( ); if ( m_applets_changed ) { QCopEnvelope e ( "QPE/TaskBar", "reloadApplets()" ); m_applets_changed = 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,135 +1,138 @@ /* 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")); GroupLight_ac->setTitle(GroupLight->title()); } else { contrast->hide(); contrast_ac->hide(); } // check whether to show the cpu frequency stuff QStrList freq = ODevice::inst()->allowedCpuFrequencies(); if ( freq.count() ) { frequency->insertStrList( freq ); frequency_ac->insertStrList( freq ); } else { frequencyLabel->hide(); frequency->hide(); frequencyLabel_ac->hide(); frequency_ac->hide(); } // check whether to show the hinge action stuff if ( !ODevice::inst()->hasHingeSensor() ) { closeHingeLabel->hide(); closeHingeAction->hide(); closeHingeLabel_ac->hide(); closeHingeAction_ac->hide(); } Config config ( "apm" ); config. setGroup ( "Battery" ); // battery spinboxes interval_dim-> setValue ( config. readNumEntry ( "Dim", 20 )); interval_lightoff-> setValue ( config. readNumEntry ( "LightOff", 30 )); interval_suspend-> setValue ( config. readNumEntry ( "Suspend", 60 )); // battery check and slider LcdOffOnly->setChecked ( config. readBoolEntry ( "LcdOffOnly", false )); // CPU frequency frequency->setCurrentItem( config.readNumEntry("Freq", 0) ); // hinge action closeHingeAction->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) ); int bright = config. readNumEntry ( "Brightness", 127 ); int contr = m_oldcontrast = config. readNumEntry ( "Contrast", 127 ); brightness-> setTickInterval ( QMAX( 16, 256 / m_bres )); brightness-> setLineStep ( QMAX( 1, 256 / m_bres )); brightness-> setPageStep ( QMAX( 1, 256 / m_bres )); brightness-> setValue ( bright ); if (m_cres) { contrast-> setTickInterval ( QMAX( 16, 256 / m_cres )); contrast-> setLineStep ( QMAX( 1, 256 / m_cres )); contrast-> setPageStep ( QMAX( 1, 256 / m_cres )); contrast-> setValue ( contr ); } // light sensor auto_brightness-> setChecked ( config. readBoolEntry ( "LightSensor", false )); m_sensordata = config. readListEntry ( "LightSensorData", ';' ); config. setGroup ( "AC" ); @@ -140,175 +143,175 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) interval_suspend_ac-> setValue ( config. readNumEntry ( "Suspend", 0 )); // ac check and slider LcdOffOnly_ac-> setChecked ( config. readBoolEntry ( "LcdOffOnly", false )); // CPU frequency frequency_ac->setCurrentItem( config.readNumEntry("Freq", 0) ); // hinge action closeHingeAction_ac->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) ); bright = config. readNumEntry ( "Brightness", 255 ); brightness_ac-> setTickInterval ( QMAX( 16, 256 / m_bres )); brightness_ac-> setLineStep ( QMAX( 1, 256 / m_bres )); brightness_ac-> setPageStep ( QMAX( 1, 256 / m_bres )); brightness_ac-> setValue ( bright ); if (m_cres) { contr = config. readNumEntry ( "Contrast", 127); contrast_ac-> setTickInterval ( QMAX( 16, 256 / m_cres )); contrast_ac-> setLineStep ( QMAX( 1, 256 / m_cres )); contrast_ac-> setPageStep ( QMAX( 1, 256 / m_cres )); contrast_ac-> setValue ( contr ); } // light sensor auto_brightness_ac-> setChecked ( config. readBoolEntry ( "LightSensor", false )); m_sensordata_ac = config. readListEntry ( "LightSensorData", ';' ); // warnings config. setGroup ( "Warnings" ); warnintervalBox-> setValue ( config. readNumEntry ( "checkinterval", 10000 ) / 1000 ); lowSpinBox-> setValue ( config. readNumEntry ( "powerverylow", 10 ) ); criticalSpinBox-> setValue ( config. readNumEntry ( "powercritical", 5 ) ); m_resettimer = new QTimer ( this ); connect ( m_resettimer, SIGNAL( timeout()), this, SLOT( resetBacklight())); if ( PowerStatusManager::readStatus ( ). acStatus ( ) != PowerStatus::Online ) { tabs-> setCurrentPage ( 0 ); } else { tabs-> setCurrentPage ( 1 ); } connect ( brightness, SIGNAL( valueChanged(int)), this, SLOT( setBacklight(int))); connect ( brightness_ac, SIGNAL( valueChanged(int)), this, SLOT( setBacklight(int))); if (m_cres) { connect ( contrast, SIGNAL( valueChanged(int)), this, SLOT( setContrast(int))); connect ( contrast_ac, SIGNAL( valueChanged(int)), this, SLOT( setContrast(int))); } connect( frequency, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) ); connect( frequency_ac, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) ); connect( closeHingeAction, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) ); connect( closeHingeAction_ac, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) ); } LightSettings::~LightSettings ( ) { } void LightSettings::calibrateSensor ( ) { Sensor *s = new Sensor ( m_sensordata, this ); 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 ( )) { config. setGroup ( "Battery" ); config. writeEntry ( "LightSensor", auto_brightness->isChecked() ); config. writeEntry ( "LightSensorData", m_sensordata, ';' ); config. setGroup ( "AC" ); config. writeEntry ( "LightSensor", auto_brightness_ac->isChecked() ); config. writeEntry ( "LightSensorData", m_sensordata_ac, ';' ); } // advanced config. setGroup ( "Warnings" ); config. writeEntry ( "check_interval", warnintervalBox-> value ( ) * 1000 ); config. writeEntry ( "power_verylow", lowSpinBox-> value ( )); config. writeEntry ( "power_critical", criticalSpinBox-> value ( )); config. write ( ); // notify the launcher { QCopEnvelope e ( "QPE/System", "reloadPowerWarnSettings()" ); } { QCopEnvelope e ( "QPE/System", "setScreenSaverInterval(int)" ); e << -1; } LightSettingsBase::accept ( ); } void LightSettings::done ( int r ) { m_resettimer-> stop ( ); resetBacklight ( ); LightSettingsBase::done ( r ); close ( ); } 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,130 +1,136 @@ /********************************************************************** ** 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"; Config loginCfg(configFile,Config::File); loginCfg.setGroup("General"); autoLoginName=loginCfg.readEntry("AutoLogin",""); if (autoLoginName.stripWhiteSpace().isEmpty()) { autoLogin=false; } else { autoLogin=true; } cfg.setGroup("SyncMode"); int mode = cfg.readNumEntry("Mode",2); // Default to Sharp switch( mode ) { case 0x01: syncModeCombo->setCurrentItem( 0 ); break; case 0x02: default: syncModeCombo->setCurrentItem( 1 ); break; case 0x04: syncModeCombo->setCurrentItem( 2 ); break; } connect(autologinToggle, SIGNAL(toggled(bool)), this, SLOT(toggleAutoLogin(bool))); connect(userlist, SIGNAL(activated(int)), this, SLOT(changeLoginName(int))); connect(changepasscode,SIGNAL(clicked()), this, SLOT(changePassCode())); connect(clearpasscode,SIGNAL(clicked()), this, SLOT(clearPassCode())); connect(restoredefaults,SIGNAL(clicked()), this, SLOT(restoreDefaults())); connect(deleteentry,SIGNAL(clicked()), this, SLOT(deleteListEntry())); loadUsers(); updateGUI(); dl = new QPEDialogListener(this); QPEApplication::showDialog( this ); } Security::~Security() { } void Security::deleteListEntry() { syncnet->removeItem(syncnet->currentItem()); } void Security::restoreDefaults() { QMessageBox unrecbox( tr("Attention"), tr( "<p>All user-defined net ranges will be lost."), QMessageBox::Warning, QMessageBox::Cancel, QMessageBox::Yes, QMessageBox::NoButton, 0, QString::null, TRUE, WStyle_StaysOnTop); unrecbox.setButtonText(QMessageBox::Cancel, tr("Cancel")); unrecbox.setButtonText(QMessageBox::Yes, tr("Ok")); if ( unrecbox.exec() == QMessageBox::Yes) { syncnet->clear(); @@ -164,193 +170,193 @@ void Security::show() //valid=FALSE; setEnabled(FALSE); SecurityBase::show(); if ( passcode.isEmpty() ) { // could insist... //changePassCode(); //if ( passcode.isEmpty() ) //reject(); } else { if (!valid) // security passcode was not asked yet, so ask now { QString pc = enterPassCode(tr("Enter passcode")); if ( pc != passcode ) { QMessageBox::critical(this, tr("Passcode incorrect"), tr("The passcode entered is incorrect.\nAccess denied")); reject(); return; } } } setEnabled(TRUE); valid=TRUE; } void Security::accept() { applySecurity(); QDialog::accept(); QCopEnvelope env("QPE/System", "securityChanged()" ); } void Security::done(int r) { QDialog::done(r); close(); } void Security::selectNet(int auth_peer,int auth_peer_bits, bool update) { QString sn; if ( auth_peer_bits == 0 && auth_peer == 0 ) { sn = tr("Any"); } else if ( auth_peer_bits == 32 && auth_peer == 0 ) { sn = tr("None"); } else { sn = QString::number((auth_peer>>24)&0xff) + "." + QString::number((auth_peer>>16)&0xff) + "." + QString::number((auth_peer>>8)&0xff) + "." + QString::number((auth_peer>>0)&0xff) + "/" + QString::number(auth_peer_bits); } //insert user-defined list of netranges upon start if (update) { //User selected/active netrange first syncnet->insertItem( tr( sn ) ); Config cfg("Security"); cfg.setGroup("Sync"); //set up defaults if needed, if someone manually deletes net0 he'll get a suprise hehe QString test = cfg.readEntry("net0",""); if (test.isEmpty()) { 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()); // Hide disabled accounts if (*account.at(1)!="*") { userlist->insertItem(*account.at(0)); // Highlight this item if it is set to autologinToggle if ( *account.at(0) == autoLoginName) userlist->setCurrentItem(userlist->count()-1); } } passwd.close(); } } void Security::toggleAutoLogin(bool val) { autoLogin=val; userlist->setEnabled(val); if (!autoLogin) autoLoginName=userlist->currentText(); } void Security::setSyncNet(const QString& sn) { int auth_peer,auth_peer_bits; parseNet(sn,auth_peer,auth_peer_bits); selectNet(auth_peer,auth_peer_bits,FALSE); } void Security::applySecurity() { if ( valid ) { Config cfg("Security"); cfg.setGroup("Passcode"); cfg.writeEntry("passcode",passcode); cfg.writeEntry("passcode_poweron",passcode_poweron->isChecked()); cfg.setGroup("Sync"); int auth_peer=0; int auth_peer_bits; QString sn = syncnet->currentText(); parseNet(sn,auth_peer,auth_peer_bits); //this is the *selected* (active) net range cfg.writeEntry("auth_peer",auth_peer); cfg.writeEntry("auth_peer_bits",auth_peer_bits); //write back all other net ranges in *cleartext* for (int i=0; i<10; i++) { QString target; target.sprintf("net%d", i); cfg.writeEntry(target,syncnet->text(i)); } #ifdef ODP #error "Use 0,1,2 and use Launcher" #endif /* keep the old code so we don't use currentItem directly */ int value = 0x02; switch( syncModeCombo->currentItem() ) { case 0: 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,268 +1,275 @@ /********************************************************************** ** 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; buf[i] = '\0'; } memset(argv0[0], '\0', argv_lth); /* clear the memory area */ (void) strcpy (argv0[0], buf); argv0[1] = NULL; } #endif 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(); } int rv = app->exec(); if ( mainWindow ) delete (QWidget*)mainWindow; delete app; if ( appIface ) loader->releaseInterface( appIface ); delete loader; // Neither QLibrary nor my Dropin is a QObject and they don't depend // on a qApp so we destroy QWidget::destroyMapper() without // crashing the app // // The problem is there are some 'static' resources not freed // in the apps and on destructing these objects are not available // anymore. In future fix up the apps but for now // we just skip deletion and hope things go well -zecke // delete app; // hack instead -zecke // delete app->pidChannel; // app->pidChannel = 0; return rv; } #include "main.moc" |