summaryrefslogtreecommitdiff
path: root/core
authorar <ar>2004-05-02 17:31:50 (UTC)
committer ar <ar>2004-05-02 17:31:50 (UTC)
commita210b9a597ba0c929d95c38ffbaf972916c7b8a7 (patch) (side-by-side diff)
treece121d5017eb054222c86e0afb6057a28ea7bf8a /core
parent18759e9156c96795831120408a9da0d3b4ec71a4 (diff)
downloadopie-a210b9a597ba0c929d95c38ffbaf972916c7b8a7.zip
opie-a210b9a597ba0c929d95c38ffbaf972916c7b8a7.tar.gz
opie-a210b9a597ba0c929d95c38ffbaf972916c7b8a7.tar.bz2
- convert qDebug to odebug
Diffstat (limited to 'core') (more/less context) (ignore whitespace changes)
-rw-r--r--core/settings/button/remapdlg.cpp72
-rw-r--r--core/settings/citytime/citytime.cpp94
-rw-r--r--core/settings/citytime/citytimebase.cpp120
-rw-r--r--core/settings/citytime/zonemap.cpp402
-rw-r--r--core/settings/launcher/doctabsettings.cpp6
-rw-r--r--core/settings/launcher/inputmethodsettings.cpp6
-rw-r--r--core/settings/launcher/tabdialog.cpp632
-rw-r--r--core/settings/launcher/taskbarsettings.cpp196
-rw-r--r--core/settings/light-and-power/light.cpp387
-rw-r--r--core/settings/security/security.cpp58
-rw-r--r--core/settings/security/security.pro14
-rw-r--r--core/symlinker/main.cpp220
-rw-r--r--core/symlinker/symlinker.pro18
-rw-r--r--core/tools/quicklauncher/main.cpp231
14 files changed, 1255 insertions, 1201 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,9 +1,15 @@
+
+#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;
@@ -15,27 +21,27 @@ public:
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 )
+
+ 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:
QString m_key;
bool m_def;
@@ -48,21 +54,21 @@ RemapDlg::RemapDlg ( const Opie::Core::ODeviceButton *b, bool hold, QWidget *par
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
@@ -70,15 +76,15 @@ RemapDlg::RemapDlg ( const Opie::Core::ODeviceButton *b, bool hold, QWidget *par
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" ));
+
+ 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()));
}
@@ -90,11 +96,11 @@ 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 ( );
}
@@ -102,32 +108,32 @@ 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 ( ) )
+ 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
+//so raise() is always present
if(m. message ( ) != "raise()")
w_message->insertItem("raise()");
w_message-> setEditText ( m. message ( ));
@@ -149,7 +155,7 @@ void RemapDlg::textChanged ( const QString &str )
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
@@ -23,18 +23,22 @@
#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,
@@ -46,7 +50,7 @@ CityTime::CityTime( QWidget *parent, const char* name,
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;
@@ -118,33 +122,33 @@ CityTime::CityTime( QWidget *parent, const char* name,
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;
}
// restore the timezone, just in case we messed with it and
// are destroyed at an inoppurtune moment
@@ -158,7 +162,7 @@ CityTime::~CityTime()
void CityTime::timerEvent( QTimerEvent *e )
{
if ( e )
- killTimer( timerId );
+ killTimer( timerId );
// change the time again!!
showTime();
int ms = 1000 - QTime::currentTime().msec();
@@ -180,7 +184,7 @@ void CityTime::showTime( void )
for ( i = 0, itTime.toFirst(); i < CITIES; i++, ++itTime) {
if ( !strCityTz[i].isNull() ) {
if ( setenv( "TZ", strCityTz[i], true ) == 0 ) {
- itTime.current()->setText( TimeString::shortTime( bWhichClock ) );
+ itTime.current()->setText( TimeString::shortTime( bWhichClock ) );
} else {
QMessageBox::critical( this, tr( "Time Changing" ),
tr( "There was a problem setting timezone %1" )
@@ -223,7 +227,7 @@ void CityTime::slotNewTz( const QString & strNewCountry,
cmdTmp->toggle();
// we can actually break, since there is only one button
// that is ever pressed!
- changed = TRUE;
+ changed = TRUE;
break;
}
}
@@ -241,15 +245,15 @@ void CityTime::readInTimes( void )
nameRealTz = QString::null;
QString zn;
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;
}
if ( i == 0 ) {
// write in our own in a shameless self promotion and some humor
@@ -263,12 +267,12 @@ 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
@@ -3,10 +3,14 @@
// 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>
@@ -19,7 +23,7 @@ CityTimeBase::CityTimeBase( QWidget* parent, const char* name, WFlags )
: QWidget( parent, name, WStyle_ContextHelp )
{
if ( !name )
- setName( "CityTimeBase" );
+ setName( "CityTimeBase" );
setCaption( tr( "City Time" ) );
CityTimeBaseLayout = new QVBoxLayout( this );
CityTimeBaseLayout->setSpacing( 3 );
@@ -341,71 +345,71 @@ 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 );
+ 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
@@ -23,9 +23,12 @@
#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>
@@ -37,6 +40,7 @@
#include <qlistview.h>
#include <qwhatsthis.h>
+/* STD */
#include <limits.h>
// the map file...
@@ -61,12 +65,12 @@ 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 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,
+ iStop,
iLen,
tmp;
QString strTmp;
@@ -75,65 +79,65 @@ ZoneField::ZoneField( const QString& strLine )
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;
- }
+ 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;
- }
+ 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 );
+ 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 );
+ 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 )
@@ -207,21 +211,21 @@ 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);
+ 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();
}
}
@@ -245,8 +249,8 @@ void ZoneMap::viewportMouseReleaseEvent( QMouseEvent* )
// more for "mouse clicks"
norm.stop();
if ( pLast != NULL ) {
- emit signalTz( pLast->country(), pLast->city() );
- pLast = NULL;
+ emit signalTz( pLast->country(), pLast->city() );
+ pLast = NULL;
}
tHide->start( 2000, true );
}
@@ -254,33 +258,33 @@ void ZoneMap::viewportMouseReleaseEvent( QMouseEvent* )
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;
}
}
@@ -292,35 +296,35 @@ ZoneField *ZoneMap::findCityNear( ZoneField *city, int key )
QListIterator<ZoneField> it( zones );
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;
+ }
}
return pClosest;
@@ -351,20 +355,20 @@ void ZoneMap::slotFindCity( const QPoint &pos )
pClosest = 0;
lClosest = LONG_MAX;
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;
+ }
}
// Okay, we found the closest city, but it might still be too far away.
if ( lClosest <= iTHRESHOLD ) {
- showCity( pClosest );
- cursor = pClosest;
+ showCity( pClosest );
+ cursor = pClosest;
}
}
@@ -381,51 +385,51 @@ void ZoneMap::showCity( ZoneField *city )
QString strSave;
char *p = getenv( "TZ" );
if ( p ) {
- strSave = p;
+ strSave = p;
}
// set the timezone :)
setenv( "TZ", strCountry + strCity, true );
lblCity->setText( strCity.replace( QRegExp("_"), " ") + "\n" +
- TimeString::shortTime( ampm ) );
+ TimeString::shortTime( ampm ) );
lblCity->setMinimumSize( lblCity->sizeHint() );
// undue our damage...
unsetenv( "TZ" );
if ( p )
- setenv( "TZ", strSave, true );
+ setenv( "TZ", strSave, true );
// Now decide where to move the label, x & y can be reused
int tmpx, tmpy, x, y;
zoneToWin( pLast->x(), pLast->y(), tmpx, tmpy );
contentsToViewport(tmpx, tmpy, x, y);
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;
}
// draw in the city and the label
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;
lblCity->move( x, y );
@@ -439,10 +443,10 @@ void ZoneMap::resizeEvent( QResizeEvent *e )
cmdZoom->move( _size.width() - cmdZoom->width(),
_size.height() - cmdZoom->height() );
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 );
}
}
@@ -451,8 +455,8 @@ void ZoneMap::showZones( void ) const
// go through the zones in the list and just display the values...
QListIterator<ZoneField> itZone( zones );
for ( itZone.toFirst(); itZone.current(); ++itZone ) {
- ZoneField *pZone = itZone.current();
- pZone->showStructure();
+ ZoneField *pZone = itZone.current();
+ pZone->showStructure();
}
}
@@ -471,7 +475,7 @@ QWidget* ZoneMap::selectionWidget( QWidget *parent) {
QStringList continentList;
QListIterator<ZoneField> itZone( zones );
for ( itZone.toFirst(); itZone.current(); ++itZone ) {
- ZoneField *pZone = itZone.current();
+ ZoneField *pZone = itZone.current();
if ( continentList.contains( pZone->country() ) == 0 ) {
QString name;
QListViewItem *item;
@@ -498,7 +502,7 @@ void ZoneMap::slotGetCities( QListViewItem * contItem) {
selectedCont = contItem->text( 1 );
QListIterator<ZoneField> itZone( zones );
for ( itZone.toFirst(); itZone.current(); ++itZone ) {
- ZoneField *pZone = itZone.current();
+ ZoneField *pZone = itZone.current();
if ( pZone->country() == contItem->text( 1 ) ) {
QListViewItem *item;
item = new QListViewItem( cityView, pZone->city() );
@@ -522,11 +526,11 @@ void ZoneMap::drawCities( QPainter *p )
p->setPen( red );
QListIterator<ZoneField> itZone( zones );
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);
}
}
@@ -563,20 +567,20 @@ static void dayNight(QImage *pImage)
iMid = ( relw * ( 24*60 - pTm->tm_hour * 60 - pTm->tm_min ) ) / ( 24*60 );
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 );
+ }
}
}
@@ -591,8 +595,8 @@ static inline void darken( QImage *pImage, int start, int stop, int row )
p = pImage->scanLine( row );
for ( j = start; j <= stop; j++ ) {
- if ( p[j] < colors )
- p[j] += colors;
+ if ( p[j] < colors )
+ p[j] += colors;
}
}
@@ -600,11 +604,11 @@ void ZoneMap::makeMap( int w, int h )
{
QImage imgOrig = Resource::loadImage( strMAP );
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);
}
// set up the color table for darkening...
@@ -614,15 +618,15 @@ void ZoneMap::makeMap( int w, int h )
imgOrig.setNumColors( 2 * numColors );
// darken the new ones...
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 ) );
}
// else go one with making the map...
if ( bIllum ) {
- // do a daylight mask
- dayNight(&imgOrig);
+ // do a daylight mask
+ dayNight(&imgOrig);
}
// redo the width and height
wImg = w;
@@ -654,7 +658,7 @@ void ZoneMap::drawContents( QPainter *p, int cx, int cy, int cw, int ch )
pixmapH = pixCurr->height();
if ( !bZoom && ( ( pixmapW != drawableW ) ||
( pixmapH != drawableH) ) ) {
- makeMap( drawableW, drawableH );
+ makeMap( drawableW, drawableH );
}
// taken from the scrollview example...
@@ -665,27 +669,27 @@ void ZoneMap::drawContents( QPainter *p, int cx, int cy, int cw, int ch )
int leftcol= cx / colwidth;
int rightcol= ( cx + cw + colwidth - 1 ) / colwidth;
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 );
+ }
}
// Draw that city!
if ( pLast )
- drawCity( p, pLast );
+ drawCity( p, pLast );
}
void ZoneMap::slotZoom( bool setZoom )
{
bZoom = 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 );
}
}
@@ -711,9 +715,9 @@ void ZoneMap::slotRedraw( void )
int x,
y;
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
@@ -28,13 +28,17 @@
#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 );
@@ -59,7 +63,7 @@ void DocTabSettings::appletChanged()
void DocTabSettings::accept()
{
- qDebug( "DocTabSettings::accept()" );
+ odebug << "DocTabSettings::accept()" << oendl;
Config cfg( "Launcher" );
cfg.setGroup( "DocTab" );
cfg.writeEntry( "Enable", _enable->isChecked() );
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
@@ -28,14 +28,18 @@
#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 );
@@ -73,7 +77,7 @@ void InputMethodSettings::appletChanged()
void InputMethodSettings::accept()
{
- qDebug( "InputMethodSettings::accept()" );
+ odebug << "InputMethodSettings::accept()" << oendl;
Config cfg( "Launcher" );
cfg.setGroup( "InputMethods" );
cfg.writeEntry( "Resize", _resize->isChecked() );
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
@@ -25,8 +25,17 @@
*/
+#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>
@@ -38,270 +47,263 @@
#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;
- }
+ 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;
};
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;
};
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." ));
}
@@ -314,13 +316,13 @@ QWidget *TabDialog::createFontTab ( QWidget *parent )
QWidget *tab = new QWidget ( parent, "FontTab" );
QVBoxLayout *vertLayout = new QVBoxLayout ( tab, 3, 3 );
- 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 );
m_fontselect = new OFontSelector ( false, tab, "fontsel" );
vertLayout-> addWidget ( m_fontselect );
- 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&)),
this, SLOT( fontClicked(const QFont&)));
@@ -341,50 +343,50 @@ QWidget *TabDialog::createBgTab ( QWidget *parent )
m_bgtype-> hide ( );
m_bgtype-> setExclusive ( true );
- QRadioButton *rb;
+ QRadioButton *rb;
rb = new QRadioButton( tr( "Ruled" ), tab, "ruled" );
m_bgtype-> insert ( rb, TabConfig::Ruled );
gridLayout-> addWidget( rb, 0, 1 );
- QHBoxLayout *hb = new QHBoxLayout ( );
- hb-> setSpacing ( 3 );
+ QHBoxLayout *hb = new QHBoxLayout ( );
+ hb-> setSpacing ( 3 );
rb = new QRadioButton( tr( "Solid color" ), tab, "solid" );
m_bgtype-> insert ( rb, TabConfig::SolidColor );
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 );
gridLayout-> addLayout ( hb, 1, 1 );
- 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 );
hb-> addWidget( rb );
hb-> addSpacing ( 10 );
- 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 );
gridLayout-> addLayout ( hb, 2, 1 );
- 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;
}
QWidget *TabDialog::createIconTab ( QWidget *parent )
@@ -401,7 +403,7 @@ QWidget *TabDialog::createIconTab ( QWidget *parent )
m_iconsize-> hide ( );
m_iconsize-> setExclusive ( true );
- QRadioButton *rb;
+ QRadioButton *rb;
rb = new QRadioButton( tr( "Small" ), tab, "iconsmall" );
m_iconsize-> insert ( rb, TabConfig::List );
gridLayout-> addWidget( rb, 0, 1 );
@@ -410,105 +412,105 @@ QWidget *TabDialog::createIconTab ( QWidget *parent )
m_iconsize-> insert ( rb, TabConfig::Icon );
gridLayout-> addWidget( rb, 1, 1 );
- 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;
}
void TabDialog::iconSizeClicked ( int s )
{
- m_sample-> setViewMode ((TabConfig::ViewMode) s );
+ m_sample-> setViewMode ((TabConfig::ViewMode) s );
}
void TabDialog::fontClicked ( const QFont &f )
{
- m_sample-> setViewFont ( f );
+ m_sample-> setViewFont ( f );
}
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 );
}
void TabDialog::bgColorClicked ( const QColor & )
{
- bgTypeClicked ( TabConfig::SolidColor );
+ bgTypeClicked ( TabConfig::SolidColor );
}
void TabDialog::iconColorClicked ( const QColor &col )
{
- m_sample-> setTextColor ( col );
+ m_sample-> setTextColor ( col );
}
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 );
+ }
}
void TabDialog::bgDefaultClicked ( )
{
- m_bgimage = "launcher/opie-background";
- bgTypeClicked ( TabConfig::Image );
+ m_bgimage = "launcher/opie-background";
+ bgTypeClicked ( TabConfig::Image );
}
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
@@ -16,7 +16,7 @@
    =_        +     =;=|` 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
@@ -28,12 +28,15 @@
#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>
@@ -41,132 +44,133 @@
#include <qlabel.h>
#include <qwhatsthis.h>
+/* STD */
#include <stdlib.h>
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 ( );
}
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;
+ }
}
void TaskbarSettings::appletChanged()
{
- m_applets_changed = true;
+ 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;
- }
+ 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
@@ -29,7 +29,9 @@
#include "light.h"
#include "sensor.h"
+/* OPIE */
#include <opie2/odevice.h>
+#include <opie2/odebug.h>
#include <qpe/config.h>
#include <qpe/power.h>
@@ -37,6 +39,7 @@
#include <qpe/qcopenvelope_qws.h>
#endif
+/* QT */
#include <qlabel.h>
#include <qcheckbox.h>
#include <qtabwidget.h>
@@ -51,42 +54,42 @@
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 ( );
// check whether to show the light sensor stuff
- 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 ( );
+ }
// 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();
- }
+ 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();
- }
+ 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
@@ -97,101 +100,101 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags )
closeHingeAction_ac->hide();
}
- 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) ) );
}
LightSettings::~LightSettings ( )
@@ -200,115 +203,115 @@ 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;
+ 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;
+ 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;
+ 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 );
+ }
}
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);
}
void LightSettings::setFrequency ( int index )
{
- qWarning("LightSettings::setFrequency(%d)", index);
- ODevice::inst ( )-> setCurrentCpuFrequency(index);
+ owarn << "LightSettings::setFrequency(" << index << ")" << oendl;
+ ODevice::inst ( )-> setCurrentCpuFrequency(index);
}
void LightSettings::resetBacklight ( )
{
- setBacklight ( -1 );
- setContrast ( -1 );
+ 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 ( );
+ 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 ( );
+ 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
@@ -19,12 +19,15 @@
**********************************************************************/
#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>
@@ -32,6 +35,9 @@
#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 )
{
@@ -118,7 +124,7 @@ void Security::restoreDefaults()
{
QMessageBox unrecbox(
tr("Attention"),
- tr( "<p>All user-defined net ranges will be lost."),
+ tr( "<p>All user-defined net ranges will be lost."),
QMessageBox::Warning,
QMessageBox::Cancel, QMessageBox::Yes, QMessageBox::NoButton,
0, QString::null, TRUE, WStyle_StaysOnTop);
@@ -170,16 +176,16 @@ void Security::show()
//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;
- }
- }
+ 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;
@@ -216,17 +222,17 @@ void Security::selectNet(int auth_peer,int auth_peer_bits, bool update)
//insert user-defined list of netranges upon start
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... :)
// If you need more, don't forget to edit applySecurity() as well
bool already_there=FALSE;
@@ -257,7 +263,7 @@ void Security::selectNet(int auth_peer,int auth_peer_bits, bool update)
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)
@@ -340,12 +346,12 @@ void Security::applySecurity()
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));
- }
+ //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"
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
+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
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,3 +1,8 @@
+
+/* OPIE */
+#include <opie2/odebug.h>
+
+/* QT */
#include <qapplication.h>
#include <qfile.h>
#include <qfileinfo.h>
@@ -5,8 +10,9 @@
#include <qtextstream.h>
#include <qstringlist.h>
+/* STD */
#include <stdlib.h>
-#include <unistd.h> //symlink()
+#include <unistd.h> //symlink()
#include <sys/stat.h> // mkdir()
#include <sys/vfs.h>
@@ -24,55 +30,55 @@ static void createSymlinks( const QString &location, const QString &package )
QFile outFile( listDir + package + ".list");
-// qDebug( "createSymlinks %s -> %s", inFile.name().ascii(), outFile.name().ascii() );
-
-
-
- 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() );
- if (s.find(location,0,true) >= 0){
-// qDebug( "Found!" );
- s = s.replace(location,"");
- }
-// qDebug( "Read after: %s", s.ascii() );
-
- // for s, do link/mkdir.
- if ( s.right(1) == "/" ) {
-// qDebug("do mkdir for %s", s.ascii());
- mkdir( s.ascii(), 0777 );
- //possible optimization: symlink directories
- //that don't exist already. -- Risky.
- } else {
-// qDebug("do symlink for %s", s.ascii());
- 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() );
- system ( QString("mkdir -p ")+e.ascii() );
- if (symlink( (location+s).ascii(), s.ascii() ) != 0)
- qDebug ("Big problem creating symlink and directory");
- }
- }
-// qDebug ( "Created %s" ,s.ascii() );
- out << s << "\n";
- } else {
- qDebug( "%s exists already, not symlinked", s.ascii() );
- }
- }
- }
- inFile.close();
- outFile.close();
+// 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'
+// odebug << "Read: " << s.ascii() << "" << oendl;
+ if (s.find(location,0,true) >= 0){
+// odebug << "Found!" << oendl;
+ s = s.replace(location,"");
+ }
+// odebug << "Read after: " << s.ascii() << "" << oendl;
+
+ // for s, do link/mkdir.
+ if ( s.right(1) == "/" ) {
+// odebug << "do mkdir for " << s.ascii() << "" << oendl;
+ mkdir( s.ascii(), 0777 );
+ //possible optimization: symlink directories
+ //that don't exist already. -- Risky.
+ } else {
+// 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(),"");
+// odebug << "DirName : " << e.ascii() << "" << oendl;
+ system ( QString("mkdir -p ")+e.ascii() );
+ if (symlink( (location+s).ascii(), s.ascii() ) != 0)
+ odebug << "Big problem creating symlink and directory" << oendl;
+ }
+ }
+// qDebug ( "Created %s" ,s.ascii() );
+ out << s << "\n";
+ } else {
+ odebug << "" << s.ascii() << " exists already, not symlinked" << oendl;
+ }
+ }
+ }
+ inFile.close();
+ outFile.close();
}
}
@@ -82,24 +88,24 @@ 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());
- 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() );
- }
- }
- inFile.close();
- inFile.remove();
+ 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'
+// 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
+// odebug << "Not removed " << s.ascii() << "" << oendl;
+ }
+ }
+ inFile.close();
+ inFile.remove();
}
}
@@ -109,7 +115,7 @@ static void removeSymlinks( const QString &package )
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
+ 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.)
@@ -119,44 +125,44 @@ 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() );
- 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() );
- knownPackages.remove( fi->fileName() );
- } else {
- //it's a new one
- createSymlinks( root, fi->baseName() );
- }
-
- }
-
- }
- }
- endmntent( mntfp );
+ while ( (me = getmntent( mntfp )) != 0 ) {
+ QString root = me->mnt_dir;
+ if ( root == "/" )
+ continue;
+
+ QString info = root + "/usr/lib/ipkg/info";
+ QDir infoDir( info );
+// 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() ) ) {
+// 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) );
+
+ for ( QStringList::Iterator it = knownPackages.begin();
+ it != knownPackages.end(); ++it ) {
+ // strip ".info" off the end.
+ removeSymlinks( (*it).left((*it).length()-5) );
}
}
@@ -167,13 +173,13 @@ 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();
+ updateSymlinks();
else if ( command == "create" && argc > 3 ) // No tr
- createSymlinks( argv[2], argv[3] );
+ createSymlinks( argv[2], argv[3] );
else if ( command == "remove" && argc > 2 ) // No tr
- removeSymlinks( argv[2] );
+ 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
+TEMPLATE = app
+CONFIG += qt warn_on
+DESTDIR = $(OPIEDIR)/bin
-HEADERS =
-SOURCES = main.cpp
-INTERFACES =
+HEADERS =
+SOURCES = main.cpp
+INTERFACES =
-TARGET = opie-update-symlinks
-INCLUDEPATH += $(OPIEDIR)/include
+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
@@ -18,6 +18,12 @@
**
**********************************************************************/
+#include "dropins.h"
+
+/* OPIE */
+#include <opie2/odebug.h>
+
+/* QT */
#include <qpainter.h>
#include <qstrlist.h>
#include <qtimer.h>
@@ -31,13 +37,14 @@
#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;
@@ -61,7 +68,7 @@ void setproctitle (const char *fmt,...) {
va_list ap;
if (!argv0)
- return;
+ return;
va_start(ap, fmt);
(void) vsnprintf(buf, SPT_BUFSIZE, fmt, ap);
@@ -69,8 +76,8 @@ void setproctitle (const char *fmt,...) {
i = strlen (buf);
if (i > argv_lth - 2) {
- i = argv_lth - 2;
- buf[i] = '\0';
+ i = argv_lth - 2;
+ buf[i] = '\0';
}
memset(argv0[0], '\0', argv_lth); /* clear the memory area */
(void) strcpy (argv0[0], buf);
@@ -86,81 +93,81 @@ class QuickLauncher : public QObject
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&)) );
+ 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" );
- exit(-1);
- }
+ 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 {
+ 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) );
- 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() );
- QStrList argList;
- argList.append( arg.utf8() );
- doQuickLaunch( argList );
- delete this;
- }
+ QStrList argList;
+
+ if ( msg == "execute(QStrList)" ) {
+ delete qlChannel;
+ QDataStream stream( data, IO_ReadOnly );
+ QStrList argList;
+ stream >> argList;
+ 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;
+ 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;
+ 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]);
+ // 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 );
+ connect(app, SIGNAL(lastWindowClosed()), app, SLOT(hideOrQuit()));
+ app->exit_loop();
+ app->initApp( myargc, myargv );
+ exec( myargc, myargv );
}
private:
@@ -178,76 +185,76 @@ int main( int argc, char** argv )
QCString arg0 = argv[0];
int sep = arg0.findRev( '/' );
if ( sep > 0 )
- arg0 = arg0.mid( sep+1 );
+ arg0 = arg0.mid( sep+1 );
if ( arg0 != "quicklauncher" ) {
- qDebug( "QuickLauncher invoked as: %s", arg0.data() );
- QuickLauncher::exec( argc, argv );
+ 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];
+ // 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" );
- // 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.
+ (void)new QuickLauncher();
+ 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();
+ TimeZone::current().isValid(); // popuplate timezone cache
+ TimeString::currentDateFormat(); // create internal structures
+ TimeString::currentAMPM();
#endif
- Resource::loadIconSet("new"); // do internal init
+ 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()) );
+ // 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();
+ app->enter_loop();
}
int rv = app->exec();
if ( mainWindow )
- delete (QWidget*)mainWindow;
-
+ delete (QWidget*)mainWindow;
+
delete app;
if ( appIface )
- loader->releaseInterface( 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