-rw-r--r-- | core/settings/button/remapdlg.cpp | 72 | ||||
-rw-r--r-- | core/settings/citytime/citytime.cpp | 94 | ||||
-rw-r--r-- | core/settings/citytime/citytimebase.cpp | 120 | ||||
-rw-r--r-- | core/settings/citytime/zonemap.cpp | 402 | ||||
-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 | 632 | ||||
-rw-r--r-- | core/settings/launcher/taskbarsettings.cpp | 196 | ||||
-rw-r--r-- | core/settings/light-and-power/light.cpp | 387 | ||||
-rw-r--r-- | core/settings/security/security.cpp | 58 | ||||
-rw-r--r-- | core/settings/security/security.pro | 14 |
11 files changed, 1014 insertions, 973 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 +1,9 @@ + +#include "remapdlg.h" +#include "buttonutils.h" + +/* OPIE */ +#include <opie2/odebug.h> + +/* QT */ #include <qlistview.h> @@ -4,4 +12,2 @@ -#include "remapdlg.h" -#include "buttonutils.h" @@ -17,3 +23,3 @@ public: } - + void setDefault ( bool b ) @@ -22,3 +28,3 @@ public: } - + virtual QString key ( int /*column*/, bool /*ascending*/ ) const @@ -27,13 +33,13 @@ public: } - - virtual void paintCell ( QPainter * p, const QColorGroup & cg, int column, int width, int align ) + + virtual void paintCell ( QPainter * p, const QColorGroup & cg, int column, int width, int align ) { if ( m_def ) { - QFont f ( listView ( )-> font ( )); - f. setBold ( true ); + QFont f ( listView ( )-> font ( )); + f. setBold ( true ); p-> setFont ( f ); } - QListViewItem::paintCell ( p, cg, column, width, align ); + QListViewItem::paintCell ( p, cg, column, width, align ); } - + private: @@ -50,9 +56,9 @@ RemapDlg::RemapDlg ( const Opie::Core::ODeviceButton *b, bool hold, QWidget *par 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" )); @@ -60,3 +66,3 @@ RemapDlg::RemapDlg ( const Opie::Core::ODeviceButton *b, bool hold, QWidget *par ((NoSortItem *) m_map_preset )-> setDefault ( true ); - + if (m_msg. channel ( ) == "ignore") @@ -64,3 +70,3 @@ RemapDlg::RemapDlg ( const Opie::Core::ODeviceButton *b, bool hold, QWidget *par m_map_custom = new NoSortItem ( w_list, 2, tr( "Custom" ), m_msg_preset. channel ( ), m_msg_preset. message ( )); - + m_current = m_map_none; @@ -72,11 +78,11 @@ RemapDlg::RemapDlg ( const Opie::Core::ODeviceButton *b, bool hold, QWidget *par } - - QListViewItem *it = new NoSortItem ( w_list, 3, tr( "Actions" )); + + 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" )); - + + m_map_show = new NoSortItem ( w_list, 4, tr( "Show" )); + w_list-> setCurrentItem ( m_current ); - + QTimer::singleShot ( 0, this, SLOT( delayedInit())); @@ -92,7 +98,7 @@ void RemapDlg::delayedInit ( ) w_list-> viewport ( )-> setUpdatesEnabled ( false ); - + ButtonUtils::inst ( )-> insertAppLnks ( m_map_show ); - + w_list-> viewport ( )-> setUpdatesEnabled ( b ); - + m_map_show-> repaint ( ); @@ -104,3 +110,3 @@ void RemapDlg::itemChanged ( QListViewItem *it ) OQCopMessage m; - + m_current = it; @@ -110,3 +116,3 @@ void RemapDlg::itemChanged ( QListViewItem *it ) m_msg = m = OQCopMessage ( "ignore", 0 ); - qDebug ("***ignoring"); + odebug << "***ignoring" << oendl; } @@ -115,7 +121,7 @@ void RemapDlg::itemChanged ( QListViewItem *it ) m_msg = m = m_msg_preset; - qDebug ("***Preset"); + odebug << "***Preset" << oendl; } - else if ( it && !it-> childCount ( ) ) + 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 ); @@ -123,9 +129,9 @@ void RemapDlg::itemChanged ( QListViewItem *it ) } - + 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 +//so raise() is always present if(m. message ( ) != "raise()") @@ -151,3 +157,3 @@ OQCopMessage RemapDlg::message ( ) //make sure to update message if typed in - itemChanged(w_list->currentItem()); + 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 @@ -25,2 +25,3 @@ +/* OPIE */ #include <qpe/qpeapplication.h> @@ -31,3 +32,5 @@ #endif +#include <opie2/odebug.h> +/* QT */ #include <qlabel.h> @@ -37,2 +40,3 @@ +/* STD */ #include <stdlib.h> @@ -48,3 +52,3 @@ CityTime::CityTime( QWidget *parent, const char* name, bWhichClock = config.readBoolEntry( "AMPM", TRUE ); - qDebug( QString("%1").arg(bWhichClock) ); + odebug << QString("%1").arg(bWhichClock) << oendl; frmMap->changeClock( bWhichClock ); @@ -120,29 +124,29 @@ 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()" ); + 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()" ); - changed = FALSE; + changed = FALSE; } @@ -160,3 +164,3 @@ void CityTime::timerEvent( QTimerEvent *e ) if ( e ) - killTimer( timerId ); + killTimer( timerId ); // change the time again!! @@ -182,3 +186,3 @@ void CityTime::showTime( void ) if ( setenv( "TZ", strCityTz[i], true ) == 0 ) { - itTime.current()->setText( TimeString::shortTime( bWhichClock ) ); + itTime.current()->setText( TimeString::shortTime( bWhichClock ) ); } else { @@ -225,3 +229,3 @@ void CityTime::slotNewTz( const QString & strNewCountry, // that is ever pressed! - changed = TRUE; + changed = TRUE; break; @@ -243,11 +247,11 @@ void CityTime::readInTimes( void ) for ( ; i < CITIES ; i++ ) { - zn = cfg.readEntry("Zone"+QString::number(i), QString::null); - if ( zn.isNull() ) - break; - QString nm = cfg.readEntry("ZoneName"+QString::number(i)); - strCityTz[i] = zn; - itCity.current()->setText(nm); - if ( zn == strRealTz ) - nameRealTz = nm; - ++itCity; + zn = cfg.readEntry("Zone"+QString::number(i), QString::null); + if ( zn.isNull() ) + break; + QString nm = cfg.readEntry("ZoneName"+QString::number(i)); + strCityTz[i] = zn; + itCity.current()->setText(nm); + if ( zn == strRealTz ) + nameRealTz = nm; + ++itCity; } @@ -265,8 +269,8 @@ void CityTime::readInTimes( void ) if ( nameRealTz.isEmpty() ) { - //remember the current time zone even if we don't have room - //to show it. - zn = cfg.readEntry("Zone"+QString::number(CITIES), QString::null); - if ( zn == strRealTz ) - nameRealTz = cfg.readEntry("ZoneName"+QString::number(CITIES)); - i++; + //remember the current time zone even if we don't have room + //to show it. + zn = cfg.readEntry("Zone"+QString::number(CITIES), QString::null); + if ( zn == strRealTz ) + nameRealTz = cfg.readEntry("ZoneName"+QString::number(CITIES)); + i++; } 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 @@ -5,6 +5,10 @@ #include "citytimebase.h" +#include "zonemap.h" + +/* OPIE */ +#include <opie2/odebug.h> +/* QT */ #include <qlabel.h> #include <qtoolbutton.h> -#include "zonemap.h" #include <qlayout.h> @@ -21,3 +25,3 @@ CityTimeBase::CityTimeBase( QWidget* parent, const char* name, WFlags ) if ( !name ) - setName( "CityTimeBase" ); + setName( "CityTimeBase" ); setCaption( tr( "City Time" ) ); @@ -343,56 +347,56 @@ bool CityTimeBase::event( QEvent* 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 ); + 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 ); } @@ -403,3 +407,3 @@ void CityTimeBase::beginNewTz() { - qWarning( "CityTimeBase::beginNewTz(): Not implemented yet!" ); + owarn << "CityTimeBase::beginNewTz(): Not implemented yet!" << oendl; } @@ -408,3 +412,3 @@ 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 @@ -25,5 +25,8 @@ +/* OPIE */ #include <qpe/resource.h> #include <qpe/qpeapplication.h> +#include <opie2/odebug.h> +/* QT */ #include <qfile.h> @@ -39,2 +42,3 @@ +/* STD */ #include <limits.h> @@ -63,3 +67,3 @@ 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 regCoord( "[-+][0-9]+" ); // the latitude QRegExp regCountry( "[A-Za-z]+/" ); // the country (not good enough) @@ -68,3 +72,3 @@ ZoneField::ZoneField( const QString& strLine ) int iStart, - iStop, + iStop, iLen, @@ -77,21 +81,21 @@ ZoneField::ZoneField( const QString& strLine ) 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; - } + 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; + } } @@ -99,18 +103,18 @@ ZoneField::ZoneField( const QString& strLine ) 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; - } + 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; + } } @@ -120,4 +124,4 @@ ZoneField::ZoneField( const QString& strLine ) if ( iStart >= 0 ) { - iLen = (iStop - iStart) + 1; - strCountry = strLine.mid( iStart, iLen ); + iLen = (iStop - iStart) + 1; + strCountry = strLine.mid( iStart, iLen ); } @@ -126,3 +130,3 @@ ZoneField::ZoneField( const QString& strLine ) if ( iStart >= 0 ) { - strCity = strLine.mid( iStart, iLen ); + strCity = strLine.mid( iStart, iLen ); } @@ -132,6 +136,6 @@ 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; } @@ -209,17 +213,17 @@ void ZoneMap::readZones( void ) 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); + 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(); + 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(); } @@ -247,4 +251,4 @@ void ZoneMap::viewportMouseReleaseEvent( QMouseEvent* ) if ( pLast != NULL ) { - emit signalTz( pLast->country(), pLast->city() ); - pLast = NULL; + emit signalTz( pLast->country(), pLast->city() ); + pLast = NULL; } @@ -256,29 +260,29 @@ void ZoneMap::keyPressEvent( QKeyEvent *ke ) switch ( ke->key() ) { - case Key_Left: - case Key_Right: - case Key_Up: - case Key_Down: { - tHide->stop(); - if ( !cursor ) - slotFindCity( QPoint( contentsWidth(), contentsHeight() ) / 2 ); - ZoneField *city = findCityNear( cursor, ke->key() ); - if ( city ) { - cursor = city; - int tmpx, tmpy; - zoneToWin( cursor->x(), cursor->y(), tmpx, tmpy ); - ensureVisible( tmpx, tmpy ); - showCity( cursor ); - tHide->start( 3000, true ); - } - } - break; - - case Key_Space: - case Key_Enter: - case Key_Return: - if ( cursor ) { - emit signalTz( cursor->country(), cursor->city() ); - tHide->start( 0, true ); - } - break; + case Key_Left: + case Key_Right: + case Key_Up: + case Key_Down: { + tHide->stop(); + if ( !cursor ) + slotFindCity( QPoint( contentsWidth(), contentsHeight() ) / 2 ); + ZoneField *city = findCityNear( cursor, ke->key() ); + if ( city ) { + cursor = city; + int tmpx, tmpy; + zoneToWin( cursor->x(), cursor->y(), tmpx, tmpy ); + ensureVisible( tmpx, tmpy ); + showCity( cursor ); + tHide->start( 3000, true ); + } + } + break; + + case Key_Space: + case Key_Enter: + case Key_Return: + if ( cursor ) { + emit signalTz( cursor->country(), cursor->city() ); + tHide->start( 0, true ); + } + break; } @@ -294,31 +298,31 @@ ZoneField *ZoneMap::findCityNear( ZoneField *city, int key ) for (; it.current(); ++it) { - pZone = it.current(); - long dx = (pZone->x() - city->x())/100; - long dy = (pZone->y() - city->y())/100; - switch ( key ) { - case Key_Right: - case Key_Left: - if ( key == Key_Left ) - dx = -dx; - if ( dx > 0 ) { - long dist = QABS(dy)*4 + dx; - if ( dist < ddist ) { - ddist = dist; - pClosest = pZone; - } - } - break; - case Key_Down: - case Key_Up: - if ( key == Key_Down ) - dy = -dy; - if ( dy > 0 ) { - long dist = QABS(dx)*4 + dy; - if ( dist < ddist ) { - ddist = dist; - pClosest = pZone; - } - } - break; - } + pZone = it.current(); + long dx = (pZone->x() - city->x())/100; + long dy = (pZone->y() - city->y())/100; + switch ( key ) { + case Key_Right: + case Key_Left: + if ( key == Key_Left ) + dx = -dx; + if ( dx > 0 ) { + long dist = QABS(dy)*4 + dx; + if ( dist < ddist ) { + ddist = dist; + pClosest = pZone; + } + } + break; + case Key_Down: + case Key_Up: + if ( key == Key_Down ) + dy = -dy; + if ( dy > 0 ) { + long dist = QABS(dx)*4 + dy; + if ( dist < ddist ) { + ddist = dist; + pClosest = pZone; + } + } + break; + } } @@ -353,10 +357,10 @@ void ZoneMap::slotFindCity( const QPoint &pos ) for (; it.current(); ++it) { - pZone = it.current(); - // use the manhattenLength, a good enough of an appoximation here - lDistance = QABS( x - pZone->x() ) + QABS( y - pZone->y() ); - // first to zero wins! - if ( lDistance < lClosest ) { - lClosest = lDistance; - pClosest = pZone; - } + pZone = it.current(); + // use the manhattenLength, a good enough of an appoximation here + lDistance = QABS( x - pZone->x() ) + QABS( y - pZone->y() ); + // first to zero wins! + if ( lDistance < lClosest ) { + lClosest = lDistance; + pClosest = pZone; + } } @@ -365,4 +369,4 @@ void ZoneMap::slotFindCity( const QPoint &pos ) if ( lClosest <= iTHRESHOLD ) { - showCity( pClosest ); - cursor = pClosest; + showCity( pClosest ); + cursor = pClosest; } @@ -383,3 +387,3 @@ void ZoneMap::showCity( ZoneField *city ) if ( p ) { - strSave = p; + strSave = p; } @@ -388,3 +392,3 @@ void ZoneMap::showCity( ZoneField *city ) lblCity->setText( strCity.replace( QRegExp("_"), " ") + "\n" + - TimeString::shortTime( ampm ) ); + TimeString::shortTime( ampm ) ); lblCity->setMinimumSize( lblCity->sizeHint() ); @@ -393,3 +397,3 @@ void ZoneMap::showCity( ZoneField *city ) if ( p ) - setenv( "TZ", strSave, true ); + setenv( "TZ", strSave, true ); // Now decide where to move the label, x & y can be reused @@ -399,19 +403,19 @@ void ZoneMap::showCity( ZoneField *city ) if ( lblCity->width() > drawableW - x ) { - // oops... try putting it on the right - x = x - lblCity->width() - iLABELOFFSET; + // oops... try putting it on the right + x = x - lblCity->width() - iLABELOFFSET; } else { - // the default... - x += iLABELOFFSET; + // the default... + x += iLABELOFFSET; } if ( lblCity->height() > drawableH - y ) { - // move it up... - y = y - lblCity->height() - iLABELOFFSET; + // move it up... + y = y - lblCity->height() - iLABELOFFSET; } else if ( y < 0 ) { - // the city is actually off the screen... - // this only happens on the a zoom when you are near the top, - // a quick workaround.. - y = iLABELOFFSET; + // the city is actually off the screen... + // this only happens on the a zoom when you are near the top, + // a quick workaround.. + y = iLABELOFFSET; } else { - // the default - y += iLABELOFFSET; + // the default + y += iLABELOFFSET; } @@ -420,10 +424,10 @@ void ZoneMap::showCity( ZoneField *city ) if ( pRepaint ) { - int repx, - repy; - zoneToWin( pRepaint->x(), pRepaint->y(), repx, repy ); - updateContents( repx - iCITYOFFSET, repy - iCITYOFFSET, - iCITYSIZE, iCITYSIZE ); + int repx, + repy; + zoneToWin( pRepaint->x(), pRepaint->y(), repx, repy ); + updateContents( repx - iCITYOFFSET, repy - iCITYOFFSET, + iCITYSIZE, iCITYSIZE ); } updateContents( tmpx - iCITYOFFSET, tmpy - iCITYOFFSET, iCITYSIZE, - iCITYSIZE ); + iCITYSIZE ); pRepaint = pLast; @@ -441,6 +445,6 @@ void ZoneMap::resizeEvent( QResizeEvent *e ) if ( !bZoom ) { - drawableW = width() - 2 * frameWidth(); - drawableH = height() - 2 * frameWidth(); - makeMap( drawableW, drawableH ); - resizeContents( drawableW, drawableH ); + drawableW = width() - 2 * frameWidth(); + drawableH = height() - 2 * frameWidth(); + makeMap( drawableW, drawableH ); + resizeContents( drawableW, drawableH ); } @@ -453,4 +457,4 @@ void ZoneMap::showZones( void ) const for ( itZone.toFirst(); itZone.current(); ++itZone ) { - ZoneField *pZone = itZone.current(); - pZone->showStructure(); + ZoneField *pZone = itZone.current(); + pZone->showStructure(); } @@ -473,3 +477,3 @@ QWidget* ZoneMap::selectionWidget( QWidget *parent) { for ( itZone.toFirst(); itZone.current(); ++itZone ) { - ZoneField *pZone = itZone.current(); + ZoneField *pZone = itZone.current(); if ( continentList.contains( pZone->country() ) == 0 ) { @@ -500,3 +504,3 @@ void ZoneMap::slotGetCities( QListViewItem * contItem) { for ( itZone.toFirst(); itZone.current(); ++itZone ) { - ZoneField *pZone = itZone.current(); + ZoneField *pZone = itZone.current(); if ( pZone->country() == contItem->text( 1 ) ) { @@ -524,7 +528,7 @@ void ZoneMap::drawCities( QPainter *p ) for ( itZone.toFirst(), j = 0; itZone.current(); ++itZone, j++ ) { - ZoneField *pZone = itZone.current(); - zoneToWin( pZone->x(), pZone->y(), x, y ); - if ( x > wImg ) - x = x - wImg; - p->drawRect( x - iCITYOFFSET, y - iCITYOFFSET, iCITYSIZE, iCITYSIZE); + ZoneField *pZone = itZone.current(); + zoneToWin( pZone->x(), pZone->y(), x, y ); + if ( x > wImg ) + x = x - wImg; + p->drawRect( x - iCITYOFFSET, y - iCITYOFFSET, iCITYSIZE, iCITYSIZE); } @@ -565,16 +569,16 @@ static void dayNight(QImage *pImage) for ( i = 0; i < hImage; i++ ) { - if ( wtab[i] > 0 ) { - iStart = iMid - wtab[i]; - iStop = iMid + wtab[i]; - if ( iStart < 0 ) { - darken( pImage, iStop, wImage + iStart, i ); - } else if ( iStop > wImage ) { - darken( pImage, iStop - wImage, iStart, i ); - } else { - darken( pImage, 0, iStart, i ); - darken( pImage, iStop, wImage, i ); - } - } else { - darken( pImage, 0, wImage, i ); - } + if ( wtab[i] > 0 ) { + iStart = iMid - wtab[i]; + iStop = iMid + wtab[i]; + if ( iStart < 0 ) { + darken( pImage, iStop, wImage + iStart, i ); + } else if ( iStop > wImage ) { + darken( pImage, iStop - wImage, iStart, i ); + } else { + darken( pImage, 0, iStart, i ); + darken( pImage, iStop, wImage, i ); + } + } else { + darken( pImage, 0, wImage, i ); + } } @@ -593,4 +597,4 @@ static inline void darken( QImage *pImage, int start, int stop, int row ) for ( j = start; j <= stop; j++ ) { - if ( p[j] < colors ) - p[j] += colors; + if ( p[j] < colors ) + p[j] += colors; } @@ -602,7 +606,7 @@ void ZoneMap::makeMap( int w, int h ) if ( imgOrig.isNull() ) { - QMessageBox::warning( this, - tr( "Couldn't Find Map" ), - tr( "<p>Couldn't load map: %1, exiting") + QMessageBox::warning( this, + tr( "Couldn't Find Map" ), + tr( "<p>Couldn't load map: %1, exiting") .arg( strMAP ) ); - exit(-1); + exit(-1); } @@ -616,5 +620,5 @@ void ZoneMap::makeMap( int w, int h ) for ( int i = 0; i < numColors; i++ ) { - QRgb rgb = imgOrig.color( i ); - imgOrig.setColor ( i + numColors, qRgb( 2 * qRed( rgb ) / 3, - 2 * qGreen( rgb ) / 3, 2 * qBlue( rgb ) / 3 ) ); + QRgb rgb = imgOrig.color( i ); + imgOrig.setColor ( i + numColors, qRgb( 2 * qRed( rgb ) / 3, + 2 * qGreen( rgb ) / 3, 2 * qBlue( rgb ) / 3 ) ); } @@ -623,4 +627,4 @@ void ZoneMap::makeMap( int w, int h ) if ( bIllum ) { - // do a daylight mask - dayNight(&imgOrig); + // do a daylight mask + dayNight(&imgOrig); } @@ -656,3 +660,3 @@ void ZoneMap::drawContents( QPainter *p, int cx, int cy, int cw, int ch ) ( pixmapH != drawableH) ) ) { - makeMap( drawableW, drawableH ); + makeMap( drawableW, drawableH ); } @@ -667,7 +671,7 @@ void ZoneMap::drawContents( QPainter *p, int cx, int cy, int cw, int ch ) for ( int r = toprow; r <= bottomrow; r++ ) { - int py = r * rowheight; - for ( int c = leftcol; c <= rightcol; c++ ) { - int px = c * colwidth; - p->drawPixmap( px, py, *pixCurr ); - } + int py = r * rowheight; + for ( int c = leftcol; c <= rightcol; c++ ) { + int px = c * colwidth; + p->drawPixmap( px, py, *pixCurr ); + } } @@ -676,3 +680,3 @@ void ZoneMap::drawContents( QPainter *p, int cx, int cy, int cw, int ch ) if ( pLast ) - drawCity( p, pLast ); + drawCity( p, pLast ); } @@ -683,7 +687,7 @@ void ZoneMap::slotZoom( bool setZoom ) if ( bZoom ) { - makeMap( 2 * wImg , 2 * hImg ); - resizeContents( wImg, hImg ); + makeMap( 2 * wImg , 2 * hImg ); + resizeContents( wImg, hImg ); } else { - makeMap( drawableW, drawableH ); - resizeContents( drawableW, drawableH ); + makeMap( drawableW, drawableH ); + resizeContents( drawableW, drawableH ); } @@ -713,5 +717,5 @@ void ZoneMap::slotRedraw( void ) if ( pRepaint ) { - pLast = 0; - zoneToWin(pRepaint->x(), pRepaint->y(), x, y); - updateContents( x - iCITYOFFSET, y - iCITYOFFSET, iCITYSIZE, iCITYSIZE); + pLast = 0; + zoneToWin(pRepaint->x(), pRepaint->y(), x, y); + updateContents( x - iCITYOFFSET, y - iCITYOFFSET, iCITYSIZE, iCITYSIZE); pRepaint = 0; 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 @@ -30,4 +30,7 @@ +/* OPIE */ #include <qpe/config.h> +#include <opie2/odebug.h> +/* QT */ #include <qcheckbox.h> @@ -37,2 +40,3 @@ + DocTabSettings::DocTabSettings( QWidget *parent, const char *name ):QWidget( parent, name ) @@ -61,3 +65,3 @@ void DocTabSettings::accept() { - qDebug( "DocTabSettings::accept()" ); + odebug << "DocTabSettings::accept()" << oendl; Config cfg( "Launcher" ); 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 @@ -30,4 +30,7 @@ +/* OPIE */ #include <qpe/config.h> +#include <opie2/odebug.h> +/* QT */ #include <qspinbox.h> @@ -38,2 +41,3 @@ + InputMethodSettings::InputMethodSettings( QWidget *parent, const char *name ):QWidget( parent, name ) @@ -75,3 +79,3 @@ void InputMethodSettings::accept() { - qDebug( "InputMethodSettings::accept()" ); + odebug << "InputMethodSettings::accept()" << oendl; Config cfg( "Launcher" ); 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 @@ -27,4 +27,13 @@ +#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> @@ -40,9 +49,2 @@ -#include <opie2/ofontselector.h> -#include <opie2/otabwidget.h> -#include <opie2/ocolorbutton.h> -#include <opie2/ofiledialog.h> - -#include "tabdialog.h" - @@ -51,24 +53,24 @@ 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; - } + 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; + QPixmap m_large, m_small; }; @@ -77,184 +79,184 @@ 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() ); - 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 ( )) { - p-> drawTiledPixmap ( r, m_bgpix, QPoint (( r. x ( ) + contentsX ( )) % m_bgpix. width ( ), - ( r. y ( ) + contentsY ( )) % m_bgpix. height ( ))); - } - else - p-> fillRect ( r, m_bgcolor ); - } + 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: { + 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 ( )) { + p-> drawTiledPixmap ( r, m_bgpix, QPoint (( r. x ( ) + contentsX ( )) % m_bgpix. width ( ), + ( r. y ( ) + contentsY ( )) % m_bgpix. height ( ))); + } + else + p-> fillRect ( r, m_bgcolor ); + } private: - QColor m_textcolor; - QColor m_bgcolor; - QPixmap m_bgpix; - TabConfig::BackgroundType m_bgtype; + QColor m_textcolor; + QColor m_bgcolor; + QPixmap m_bgpix; + TabConfig::BackgroundType m_bgtype; }; @@ -264,42 +266,42 @@ private: TabDialog::TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig &tc, QWidget *parent, const char *dname, bool modal, WFlags fl ) - : QDialog ( parent, dname, modal, fl | WStyle_ContextHelp ), m_tc ( tc ) + : QDialog ( parent, dname, modal, fl | WStyle_ContextHelp ), m_tc ( tc ) { - setCaption ( tr( "Edit Tab" )); + setCaption ( tr( "Edit Tab" )); - QVBoxLayout *lay = new QVBoxLayout ( this, 3, 3 ); + QVBoxLayout *lay = new QVBoxLayout ( this, 3, 3 ); - OTabWidget *tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); - QWidget *bgtab; + OTabWidget *tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); + QWidget *bgtab; - tw-> addTab ( bgtab = createBgTab ( tw ), "appearance/color", tr( "Background" )); - tw-> addTab ( createFontTab ( tw ), "font", tr( "Font" )); - tw-> addTab ( createIconTab ( tw ), "pixmap", tr( "Icons" ) ); + tw-> addTab ( bgtab = createBgTab ( tw ), "appearance/color", tr( "Background" )); + tw-> addTab ( createFontTab ( tw ), "font", tr( "Font" )); + tw-> addTab ( createIconTab ( tw ), "pixmap", tr( "Icons" ) ); - tw-> setCurrentTab ( bgtab ); + tw-> setCurrentTab ( bgtab ); - QWidget *sample = new QVBox ( this ); - QTabBar *tb = new QTabBar ( sample ); - QString name ( tr( "Previewing %1" ). arg ( tabname )); + QWidget *sample = new QVBox ( this ); + QTabBar *tb = new QTabBar ( sample ); + QString name ( tr( "Previewing %1" ). arg ( tabname )); - tb-> addTab ( tabicon ? new QTab ( *tabicon, name ) : new QTab ( name )); + tb-> addTab ( tabicon ? new QTab ( *tabicon, name ) : new QTab ( name )); - m_sample = new SampleView ( sample ); + m_sample = new SampleView ( sample ); - lay-> addWidget ( tw, 10 ); - lay-> addWidget ( sample, 1 ); + lay-> addWidget ( tw, 10 ); + lay-> addWidget ( sample, 1 ); - m_iconsize-> setButton ( tc. m_view ); - iconSizeClicked ( tc. m_view ); - //m_iconcolor-> setColor ( QColor ( m_tc. m_text_color )); - iconColorClicked ( m_iconcolor-> color ( )); - m_bgtype-> setButton ( tc. m_bg_type ); - //m_solidcolor-> setColor ( QColor ( tc. m_bg_color )); - m_bgimage = tc. m_bg_image; - bgTypeClicked ( tc. m_bg_type ); - m_fontuse-> setChecked ( tc. m_font_use ); - m_fontselect-> setSelectedFont ( QFont ( tc. m_font_family, tc. m_font_size, tc. m_font_weight, tc. m_font_italic )); - m_fontselect-> setEnabled ( m_fontuse-> isChecked ( )); - fontClicked ( m_fontselect-> selectedFont ( )); + m_iconsize-> setButton ( tc. m_view ); + iconSizeClicked ( tc. m_view ); + //m_iconcolor-> setColor ( QColor ( m_tc. m_text_color )); + iconColorClicked ( m_iconcolor-> color ( )); + m_bgtype-> setButton ( tc. m_bg_type ); + //m_solidcolor-> setColor ( QColor ( tc. m_bg_color )); + m_bgimage = tc. m_bg_image; + bgTypeClicked ( tc. m_bg_type ); + m_fontuse-> setChecked ( tc. m_font_use ); + m_fontselect-> setSelectedFont ( QFont ( tc. m_font_family, tc. m_font_size, tc. m_font_weight, tc. m_font_italic )); + m_fontselect-> setEnabled ( m_fontuse-> isChecked ( )); + fontClicked ( m_fontselect-> selectedFont ( )); - QWhatsThis::add ( sample, tr( "This is a rough preview of what the currently selected Tab will look like." )); + QWhatsThis::add ( sample, tr( "This is a rough preview of what the currently selected Tab will look like." )); } @@ -316,4 +318,4 @@ QWidget *TabDialog::createFontTab ( QWidget *parent ) - m_fontuse = new QCheckBox ( tr( "Use a custom font" ), tab ); - vertLayout-> addWidget ( m_fontuse ); + m_fontuse = new QCheckBox ( tr( "Use a custom font" ), tab ); + vertLayout-> addWidget ( m_fontuse ); @@ -322,3 +324,3 @@ QWidget *TabDialog::createFontTab ( QWidget *parent ) - connect ( m_fontuse, SIGNAL( toggled(bool)), m_fontselect, SLOT( setEnabled(bool))); + connect ( m_fontuse, SIGNAL( toggled(bool)), m_fontselect, SLOT( setEnabled(bool))); connect( m_fontselect, SIGNAL( fontSelected(const QFont&)), @@ -343,3 +345,3 @@ QWidget *TabDialog::createBgTab ( QWidget *parent ) - QRadioButton *rb; + QRadioButton *rb; rb = new QRadioButton( tr( "Ruled" ), tab, "ruled" ); @@ -348,4 +350,4 @@ QWidget *TabDialog::createBgTab ( QWidget *parent ) - QHBoxLayout *hb = new QHBoxLayout ( ); - hb-> setSpacing ( 3 ); + QHBoxLayout *hb = new QHBoxLayout ( ); + hb-> setSpacing ( 3 ); @@ -354,8 +356,8 @@ QWidget *TabDialog::createBgTab ( QWidget *parent ) hb-> addWidget ( rb ); - hb-> addSpacing ( 10 ); + hb-> addSpacing ( 10 ); - m_solidcolor = new Opie::OColorButton ( tab, QColor ( m_tc. m_bg_color ) ); - connect ( m_solidcolor, SIGNAL( colorSelected(const QColor&)), this, SLOT( bgColorClicked(const QColor&))); - hb-> addWidget ( m_solidcolor ); - hb-> addStretch ( 10 ); + m_solidcolor = new Opie::OColorButton ( tab, QColor ( m_tc. m_bg_color ) ); + connect ( m_solidcolor, SIGNAL( colorSelected(const QColor&)), this, SLOT( bgColorClicked(const QColor&))); + hb-> addWidget ( m_solidcolor ); + hb-> addStretch ( 10 ); @@ -363,6 +365,6 @@ QWidget *TabDialog::createBgTab ( QWidget *parent ) - hb = new QHBoxLayout ( ); - hb-> setSpacing ( 3 ); + hb = new QHBoxLayout ( ); + hb-> setSpacing ( 3 ); - rb = new QRadioButton( tr( "Image" ), tab, "image" ); + rb = new QRadioButton( tr( "Image" ), tab, "image" ); m_bgtype-> insert ( rb, TabConfig::Image ); @@ -371,6 +373,6 @@ QWidget *TabDialog::createBgTab ( QWidget *parent ) - m_imagebrowse = new QPushButton ( tr( "Select..." ), tab ); - connect ( m_imagebrowse, SIGNAL( clicked()), this, SLOT( bgImageClicked())); - hb-> addWidget ( m_imagebrowse ); - hb-> addStretch ( 10 ); + m_imagebrowse = new QPushButton ( tr( "Select..." ), tab ); + connect ( m_imagebrowse, SIGNAL( clicked()), this, SLOT( bgImageClicked())); + hb-> addWidget ( m_imagebrowse ); + hb-> addStretch ( 10 ); @@ -378,11 +380,11 @@ QWidget *TabDialog::createBgTab ( QWidget *parent ) - QPushButton *p = new QPushButton ( tr( "Default" ), tab ); - connect ( p, SIGNAL( clicked()), this, SLOT( bgDefaultClicked())); - gridLayout-> addWidget ( p, 3, 1 ); + QPushButton *p = new QPushButton ( tr( "Default" ), tab ); + connect ( p, SIGNAL( clicked()), this, SLOT( bgDefaultClicked())); + gridLayout-> addWidget ( p, 3, 1 ); - connect ( m_bgtype, SIGNAL( clicked(int)), this, SLOT( bgTypeClicked(int))); + connect ( m_bgtype, SIGNAL( clicked(int)), this, SLOT( bgTypeClicked(int))); - vertLayout-> addStretch ( 10 ); + vertLayout-> addStretch ( 10 ); - return tab; + return tab; } @@ -403,3 +405,3 @@ QWidget *TabDialog::createIconTab ( QWidget *parent ) - QRadioButton *rb; + QRadioButton *rb; rb = new QRadioButton( tr( "Small" ), tab, "iconsmall" ); @@ -412,19 +414,19 @@ QWidget *TabDialog::createIconTab ( QWidget *parent ) - connect ( m_iconsize, SIGNAL( clicked(int)), this, SLOT( iconSizeClicked(int))); + connect ( m_iconsize, SIGNAL( clicked(int)), this, SLOT( iconSizeClicked(int))); -// vertLayout-> addSpacing ( 8 ); +// vertLayout-> addSpacing ( 8 ); -// gridLayout = new QGridLayout ( vertLayout ); - gridLayout-> addRowSpacing ( 2, 8 ); +// gridLayout = new QGridLayout ( vertLayout ); + gridLayout-> addRowSpacing ( 2, 8 ); - label = new QLabel ( tr( "Color:" ), tab ); - gridLayout-> addWidget ( label, 3, 0 ); + label = new QLabel ( tr( "Color:" ), tab ); + gridLayout-> addWidget ( label, 3, 0 ); - m_iconcolor = new Opie::OColorButton ( tab, QColor ( m_tc. m_text_color ) ); - connect ( m_iconcolor, SIGNAL( colorSelected(const QColor&)), this, SLOT( iconColorClicked(const QColor&))); - gridLayout-> addWidget ( m_iconcolor, 3, 1, AlignLeft ); + m_iconcolor = new Opie::OColorButton ( tab, QColor ( m_tc. m_text_color ) ); + connect ( m_iconcolor, SIGNAL( colorSelected(const QColor&)), this, SLOT( iconColorClicked(const QColor&))); + gridLayout-> addWidget ( m_iconcolor, 3, 1, AlignLeft ); - vertLayout-> addStretch ( 10 ); + vertLayout-> addStretch ( 10 ); - return tab; + return tab; } @@ -434,3 +436,3 @@ void TabDialog::iconSizeClicked ( int s ) { - m_sample-> setViewMode ((TabConfig::ViewMode) s ); + m_sample-> setViewMode ((TabConfig::ViewMode) s ); } @@ -439,3 +441,3 @@ void TabDialog::fontClicked ( const QFont &f ) { - m_sample-> setViewFont ( f ); + m_sample-> setViewFont ( f ); } @@ -444,16 +446,16 @@ void TabDialog::bgTypeClicked ( int t ) { - QString s; + QString s; - if ( m_bgtype-> id ( m_bgtype-> selected ( )) != t ) - m_bgtype-> setButton ( t ); + if ( m_bgtype-> id ( m_bgtype-> selected ( )) != t ) + m_bgtype-> setButton ( t ); - m_solidcolor-> setEnabled ( t == TabConfig::SolidColor ); - m_imagebrowse-> setEnabled ( t == TabConfig::Image ); + m_solidcolor-> setEnabled ( t == TabConfig::SolidColor ); + m_imagebrowse-> setEnabled ( t == TabConfig::Image ); - if ( t == TabConfig::SolidColor ) - s = m_solidcolor-> color ( ). name ( ); - else if ( t == TabConfig::Image ) - s = Resource::findPixmap ( m_bgimage ); + if ( t == TabConfig::SolidColor ) + s = m_solidcolor-> color ( ). name ( ); + else if ( t == TabConfig::Image ) + s = Resource::findPixmap ( m_bgimage ); - m_sample-> setBackgroundType ((TabConfig::BackgroundType) t, s ); + m_sample-> setBackgroundType ((TabConfig::BackgroundType) t, s ); } @@ -462,3 +464,3 @@ void TabDialog::bgColorClicked ( const QColor & ) { - bgTypeClicked ( TabConfig::SolidColor ); + bgTypeClicked ( TabConfig::SolidColor ); } @@ -467,3 +469,3 @@ void TabDialog::iconColorClicked ( const QColor &col ) { - m_sample-> setTextColor ( col ); + m_sample-> setTextColor ( col ); } @@ -472,15 +474,15 @@ void TabDialog::bgImageClicked ( ) { - // ### use OFileSelector here ### - // this is just a quick c&p from the old appearance app - - MimeTypes types; - QStringList list; - list << "image/*"; - types. insert ( "Images", list ); - - QString file = OFileDialog::getOpenFileName ( 1, "/", QString::null, types ); - if ( !file. isEmpty ( )) { - m_bgimage = DocLnk ( file ). file ( ); - bgTypeClicked ( TabConfig::Image ); - } + // ### use OFileSelector here ### + // this is just a quick c&p from the old appearance app + + MimeTypes types; + QStringList list; + list << "image/*"; + types. insert ( "Images", list ); + + QString file = OFileDialog::getOpenFileName ( 1, "/", QString::null, types ); + if ( !file. isEmpty ( )) { + m_bgimage = DocLnk ( file ). file ( ); + bgTypeClicked ( TabConfig::Image ); + } } @@ -489,4 +491,4 @@ void TabDialog::bgDefaultClicked ( ) { - m_bgimage = "launcher/opie-background"; - bgTypeClicked ( TabConfig::Image ); + m_bgimage = "launcher/opie-background"; + bgTypeClicked ( TabConfig::Image ); } @@ -495,20 +497,20 @@ void TabDialog::accept ( ) { - m_tc. m_view = (TabConfig::ViewMode) m_iconsize-> id ( m_iconsize-> selected ( )); - m_tc. m_bg_type = (TabConfig::BackgroundType) m_bgtype-> id ( m_bgtype-> selected ( )); - m_tc. m_bg_color = m_solidcolor-> color ( ). name ( ); - m_tc. m_bg_image = m_bgimage; - m_tc. m_text_color = m_iconcolor-> color ( ). name ( ); + m_tc. m_view = (TabConfig::ViewMode) m_iconsize-> id ( m_iconsize-> selected ( )); + m_tc. m_bg_type = (TabConfig::BackgroundType) m_bgtype-> id ( m_bgtype-> selected ( )); + m_tc. m_bg_color = m_solidcolor-> color ( ). name ( ); + m_tc. m_bg_image = m_bgimage; + m_tc. m_text_color = m_iconcolor-> color ( ). name ( ); - m_tc. m_font_use = m_fontuse-> isChecked ( ); + m_tc. m_font_use = m_fontuse-> isChecked ( ); - if ( m_tc. m_font_use ) { - QFont f = m_fontselect-> selectedFont ( ); + if ( m_tc. m_font_use ) { + QFont f = m_fontselect-> selectedFont ( ); - m_tc. m_font_family = f. family ( ); - m_tc. m_font_size = f. pointSize ( ); - m_tc. m_font_weight = f. weight ( ); - m_tc. m_font_italic = f. italic ( ); - } + m_tc. m_font_family = f. family ( ); + m_tc. m_font_size = f. pointSize ( ); + m_tc. m_font_weight = f. weight ( ); + m_tc. m_font_italic = f. italic ( ); + } - QDialog::accept ( ); + QDialog::accept ( ); } 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 @@ -18,3 +18,3 @@ ..}^=.= = ; Public License for more details. -++= -. .` .: +++= -. .` .: : = ...= . :.=- You should have received a copy of the GNU @@ -30,2 +30,3 @@ +/* OPIE */ #include <qpe/config.h> @@ -35,3 +36,5 @@ #include <qpe/qcopenvelope_qws.h> +#include <opie2/odebug.h> +/* QT */ #include <qdir.h> @@ -43,2 +46,3 @@ +/* STD */ #include <stdlib.h> @@ -47,22 +51,22 @@ TaskbarSettings::TaskbarSettings ( QWidget *parent, const char *name ) - : QWidget ( parent, name ) + : QWidget ( parent, name ) { - m_applets_changed = false; + m_applets_changed = false; - QBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); + QBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); - QLabel *l = new QLabel ( tr( "Load applets in Taskbar:" ), this ); - lay-> addWidget ( l ); + 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 ( ); + m_list = new QListView ( this ); + m_list-> addColumn ( "foobar" ); + m_list-> header ( )-> hide ( ); - lay-> addWidget ( m_list ); + lay-> addWidget ( m_list ); - QWhatsThis::add ( m_list, tr( "Check the applets that you want displayed in the Taskbar." )); + QWhatsThis::add ( m_list, tr( "Check the applets that you want displayed in the Taskbar." )); - connect ( m_list, SIGNAL( clicked(QListViewItem*)), this, SLOT( appletChanged())); + connect ( m_list, SIGNAL( clicked(QListViewItem*)), this, SLOT( appletChanged())); - init ( ); + init ( ); } @@ -71,73 +75,73 @@ void TaskbarSettings::init ( ) { - Config cfg ( "Taskbar" ); - cfg. setGroup ( "Applets" ); - QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' ); + Config cfg ( "Taskbar" ); + cfg. setGroup ( "Applets" ); + QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' ); - QString path = QPEApplication::qpeDir ( ) + "/plugins/applets"; + QString path = QPEApplication::qpeDir ( ) + "/plugins/applets"; #ifdef Q_OS_MACX - QStringList list = QDir ( path, "lib*.dylib" ). entryList ( ); + QStringList list = QDir ( path, "lib*.dylib" ). entryList ( ); #else - QStringList list = QDir ( path, "lib*.so" ). entryList ( ); + 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() ); - QLibrary *lib = new QLibrary ( path + "/" + *it ); - lib-> queryInterface ( IID_TaskbarNamedApplet, (QUnknownInterface**) &iface ); - qWarning("<1>"); - if ( iface ) { - qWarning("<2>"); - 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>"); - if ( !iface ) { - qWarning("<4>"); - lib-> queryInterface ( IID_TaskbarApplet, (QUnknownInterface**) &iface ); - - if ( iface ) { - qWarning("<5>"); - name = (*it). mid ( 3 ); - qWarning("Found applet: %s", name.latin1() ); + for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) { + QString name; + QPixmap icon; + TaskbarNamedAppletInterface *iface = 0; + + owarn << "Load applet: " << (*it) << "" << oendl; + QLibrary *lib = new QLibrary ( path + "/" + *it ); + lib-> queryInterface ( IID_TaskbarNamedApplet, (QUnknownInterface**) &iface ); + owarn << "<1>" << oendl; + if ( iface ) { + 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 ( ); + } + owarn << "<3>" << oendl; + if ( !iface ) { + owarn << "<4>" << oendl; + lib-> queryInterface ( IID_TaskbarApplet, (QUnknownInterface**) &iface ); + + if ( iface ) { + owarn << "<5>" << oendl; + name = (*it). mid ( 3 ); + owarn << "Found applet: " << name << "" << oendl; #ifdef Q_OS_MACX - int sep = name. find( ".dylib" ); + int sep = name. find( ".dylib" ); #else - int sep = name. find( ".so" ); + 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>"); - - if ( iface ) { - qWarning("<7>"); - 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; - } + 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 ( ); + } + } + owarn << "<6>" << oendl; + + if ( iface ) { + 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; + } } @@ -146,3 +150,3 @@ void TaskbarSettings::appletChanged() { - m_applets_changed = true; + m_applets_changed = true; } @@ -151,21 +155,21 @@ 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; - } + 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 @@ -31,3 +31,5 @@ +/* OPIE */ #include <opie2/odevice.h> +#include <opie2/odebug.h> @@ -39,2 +41,3 @@ +/* QT */ #include <qlabel.h> @@ -53,6 +56,6 @@ using namespace Opie::Core; LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) - : LightSettingsBase( parent, name, false, WStyle_ContextHelp ) + : LightSettingsBase( parent, name, false, WStyle_ContextHelp ) { - m_bres = ODevice::inst ( )-> displayBrightnessResolution ( ); - m_cres = ODevice::inst ( )-> displayContrastResolution ( ); + m_bres = ODevice::inst ( )-> displayBrightnessResolution ( ); + m_cres = ODevice::inst ( )-> displayContrastResolution ( ); @@ -60,8 +63,8 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) - if ( !ODevice::inst ( )-> hasLightSensor ( )) { - auto_brightness-> hide ( ); - CalibrateLightSensor-> hide ( ); - auto_brightness_ac-> hide ( ); - CalibrateLightSensor_ac-> hide ( ); - } + if ( !ODevice::inst ( )-> hasLightSensor ( )) { + auto_brightness-> hide ( ); + CalibrateLightSensor-> hide ( ); + auto_brightness_ac-> hide ( ); + CalibrateLightSensor_ac-> hide ( ); + } @@ -69,9 +72,9 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) - if (m_cres) { - GroupLight->setTitle(tr("Backlight && Contrast")); - GroupLight_ac->setTitle(GroupLight->title()); - } else { - contrast->hide(); - contrast_ac->hide(); - } + if (m_cres) { + GroupLight->setTitle(tr("Backlight && Contrast")); + GroupLight_ac->setTitle(GroupLight->title()); + } else { + contrast->hide(); + contrast_ac->hide(); + } @@ -79,12 +82,12 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) - 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(); - } + 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(); + } @@ -99,97 +102,97 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) - Config config ( "apm" ); - config. setGroup ( "Battery" ); + 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 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 )); + // battery check and slider + LcdOffOnly->setChecked ( config. readBoolEntry ( "LcdOffOnly", false )); - // CPU frequency - frequency->setCurrentItem( config.readNumEntry("Freq", 0) ); + // CPU frequency + frequency->setCurrentItem( config.readNumEntry("Freq", 0) ); - // hinge action - closeHingeAction->setCurrentItem( config.readNumEntry("CloseHingeAction", 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" ); - - // ac spinboxes - interval_dim_ac-> setValue ( config. readNumEntry ( "Dim", 60 )); - interval_lightoff_ac-> setValue ( config. readNumEntry ( "LightOff", 120 )); - 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) ) ); + 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" ); + + // ac spinboxes + interval_dim_ac-> setValue ( config. readNumEntry ( "Dim", 60 )); + interval_lightoff_ac-> setValue ( config. readNumEntry ( "LightOff", 120 )); + 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) ) ); } @@ -202,6 +205,6 @@ void LightSettings::calibrateSensor ( ) { - Sensor *s = new Sensor ( m_sensordata, this ); - connect ( s, SIGNAL( viewBacklight(int)), this, SLOT( setBacklight(int))); - QPEApplication::execDialog( s ); - delete s; + Sensor *s = new Sensor ( m_sensordata, this ); + connect ( s, SIGNAL( viewBacklight(int)), this, SLOT( setBacklight(int))); + QPEApplication::execDialog( s ); + delete s; } @@ -210,6 +213,6 @@ 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; + Sensor *s = new Sensor ( m_sensordata_ac, this ); + connect ( s, SIGNAL( viewBacklight(int)), this, SLOT( setBacklight(int))); + QPEApplication::execDialog ( s ); + delete s; } @@ -218,9 +221,9 @@ void LightSettings::setBacklight ( int bright ) { - QCopEnvelope e ( "QPE/System", "setBacklight(int)" ); - e << bright; + QCopEnvelope e ( "QPE/System", "setBacklight(int)" ); + e << bright; - if ( bright != -1 ) { - m_resettimer-> stop ( ); - m_resettimer-> start ( 4000, true ); - } + if ( bright != -1 ) { + m_resettimer-> stop ( ); + m_resettimer-> start ( 4000, true ); + } } @@ -229,4 +232,4 @@ void LightSettings::setContrast ( int contr ) { - if (contr == -1) contr = m_oldcontrast; - ODevice::inst ( )-> setDisplayContrast(contr); + if (contr == -1) contr = m_oldcontrast; + ODevice::inst ( )-> setDisplayContrast(contr); } @@ -235,4 +238,4 @@ void LightSettings::setFrequency ( int index ) { - qWarning("LightSettings::setFrequency(%d)", index); - ODevice::inst ( )-> setCurrentCpuFrequency(index); + owarn << "LightSettings::setFrequency(" << index << ")" << oendl; + ODevice::inst ( )-> setCurrentCpuFrequency(index); } @@ -241,4 +244,4 @@ void LightSettings::resetBacklight ( ) { - setBacklight ( -1 ); - setContrast ( -1 ); + setBacklight ( -1 ); + setContrast ( -1 ); } @@ -247,3 +250,3 @@ void LightSettings::setCloseHingeAction ( int index ) { - qWarning("LightSettings::setCloseHingeStatus(%d)", index); + owarn << "LightSettings::setCloseHingeStatus(" << index << ")" << oendl; } @@ -252,54 +255,54 @@ 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 ( ); + 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 ( ); } @@ -308,7 +311,7 @@ void LightSettings::done ( int r ) { - m_resettimer-> stop ( ); - resetBacklight ( ); + m_resettimer-> stop ( ); + resetBacklight ( ); - LightSettingsBase::done ( r ); - close ( ); + 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 @@ -21,2 +21,3 @@ +/* OPIE */ #include <qpe/qpeapplication.h> @@ -26,3 +27,5 @@ #include <qpe/qcopenvelope_qws.h> +#include <opie2/odebug.h> +/* QT */ #include <qcheckbox.h> @@ -34,2 +37,5 @@ + +using namespace Opie::Core; + Security::Security( QWidget* parent, const char* name, WFlags fl ) @@ -120,3 +126,3 @@ void Security::restoreDefaults() tr("Attention"), - tr( "<p>All user-defined net ranges will be lost."), + tr( "<p>All user-defined net ranges will be lost."), QMessageBox::Warning, @@ -172,12 +178,12 @@ void Security::show() } 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; - } - } + 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; + } + } } @@ -218,13 +224,13 @@ void Security::selectNet(int auth_peer,int auth_peer_bits, bool update) if (update) { - //User selected/active netrange first - syncnet->insertItem( tr( sn ) ); + //User selected/active netrange first + syncnet->insertItem( tr( sn ) ); - Config cfg("Security"); - cfg.setGroup("Sync"); + 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()) { + //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 { + } else { // 10 ought to be enough for everybody... :) @@ -259,3 +265,3 @@ void Security::selectNet(int auth_peer,int auth_peer_bits, bool update) } - qDebug("No match for \"%s\"",sn.latin1()); + odebug << "No match for \"" << sn << "\"" << oendl; } @@ -342,8 +348,8 @@ void Security::applySecurity() - //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)); - } + //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)); + } 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,9 +1,9 @@ -CONFIG += qt warn_on quick-app -HEADERS = security.h -SOURCES = security.cpp main.cpp -INTERFACES = securitybase.ui +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 -TARGET = security +DEPENDPATH += ../$(OPIEDIR)/include +LIBS += -lqpe -lopiecore2 +TARGET = security |