summaryrefslogtreecommitdiff
path: root/core/launcher/firstuse.cpp
Side-by-side diff
Diffstat (limited to 'core/launcher/firstuse.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/firstuse.cpp44
1 files changed, 23 insertions, 21 deletions
diff --git a/core/launcher/firstuse.cpp b/core/launcher/firstuse.cpp
index 4316648..e9e2d83 100644
--- a/core/launcher/firstuse.cpp
+++ b/core/launcher/firstuse.cpp
@@ -20,47 +20,49 @@
// I need access to some things you don't normally get access to.
#ifndef _MSC_VER
//### revise to allow removal of translators under MSVC
#define private public
#define protected public
#endif
#include "firstuse.h"
#include "inputmethods.h"
#include "applauncher.h"
#include "serverapp.h"
-//#include <qtopia/custom.h>
-
#include "calibrate.h"
#include "documentlist.h"
+/* OPIE */
+#include <opie2/odebug.h>
#include <qtopia/resource.h>
#include <qtopia/qcopenvelope_qws.h>
#include <qtopia/config.h>
#include <qtopia/fontmanager.h>
+using namespace Opie::Core;
+/* QT */
#include <qfile.h>
#include <qpainter.h>
#include <qsimplerichtext.h>
#include <qpushbutton.h>
#include <qlabel.h>
#include <qtimer.h>
#if defined( Q_WS_QWS )
#include <qwsdisplay_qws.h>
#include <qgfx_qws.h>
#endif
-
+/* STD */
#include <stdlib.h>
#include <sys/types.h>
#if defined(Q_OS_LINUX) || defined(_OS_LINUX_)
#include <unistd.h>
#endif
struct {
bool enabled;
const char *app;
const char *start;
const char *stop;
@@ -146,25 +148,25 @@ FirstUse::FirstUse(QWidget* parent, const char * name, WFlags wf) :
inputMethods->setGeometry(0,0, sz.width(), controlHeight );
x += sz.width();
back->setGeometry(x, 0, buttonWidth, controlHeight);
x += buttonWidth;
next->setGeometry(x, 0, buttonWidth, controlHeight);
taskBar->setGeometry( 0, height() - controlHeight, desk.width(), controlHeight);
taskBar->hide();
#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
- qDebug("Setting up QCop to QPE/System");
+ odebug << "Setting up QCop to QPE/System" << oendl;
QCopChannel* sysChannel = new QCopChannel( "QPE/System", this );
connect(sysChannel, SIGNAL(received(const QCString&,const QByteArray&)),
this, SLOT(message(const QCString&,const QByteArray&)) );
#endif
calcMaxWindowRect();
m_calHandler = ( QWSServer::mouseHandler() && QWSServer::mouseHandler()->inherits("QCalibratedMouseHandler") ) ? true : false;
if ( m_calHandler) {
if ( !QFile::exists("/etc/pointercal") ) {
needCalibrate = TRUE;
grabMouse();
@@ -214,122 +216,122 @@ void FirstUse::calcMaxWindowRect()
#else
QWSServer::setMaxWindowRect( wr );
#endif
#endif
}
/* cancel current dialog, and bring up next */
void FirstUse::nextDialog()
{
int prevApp = currApp;
do {
currApp++;
- qDebug( "currApp = %d", currApp );
+ odebug << "currApp = " << currApp << "" << oendl;
if ( settingsTable[currApp].app == 0 ) {
if ( prevApp >= 0 && appLauncher->isRunning(settingsTable[prevApp].app) ) {
// The last application is still running.
// Tell it to stop, and when its done we'll come back
// to nextDialog and exit.
- qDebug( "Waiting for %s to exit", settingsTable[prevApp].app );
+ odebug << "Waiting for " << settingsTable[prevApp].app << " to exit" << oendl;
QCopEnvelope e(QCString("QPE/Application/") + settingsTable[prevApp].app,
settingsTable[prevApp].stop );
currApp = prevApp;
} else {
- qDebug( "Done!" );
+ odebug << "Done!" << oendl;
Config config( "qpe" );
config.setGroup( "Startup" );
config.writeEntry( "FirstUse", FALSE );
QPixmap pix = Resource::loadPixmap("bigwait");
QLabel *lblWait = new QLabel(0, "wait hack!", // No tr
QWidget::WStyle_Customize | QWidget::WDestructiveClose |
QWidget::WStyle_NoBorder | QWidget::WStyle_Tool |
QWidget::WStyle_StaysOnTop);
lblWait->setPixmap( pix );
lblWait->setAlignment( QWidget::AlignCenter );
lblWait->setGeometry( qApp->desktop()->geometry() );
lblWait->show();
qApp->processEvents();
QTimer::singleShot( 1000, lblWait, SLOT(close()) );
repaint();
close();
ServerApplication::allowRestart = TRUE;
}
return;
}
} while ( !settingsTable[currApp].enabled );
if ( prevApp >= 0 && appLauncher->isRunning(settingsTable[prevApp].app) ) {
- qDebug( "Shutdown: %s", settingsTable[prevApp].app );
+ odebug << "Shutdown: " << settingsTable[prevApp].app << "" << oendl;
QCopEnvelope e(QCString("QPE/Application/") + settingsTable[prevApp].app,
settingsTable[prevApp].stop );
waitForExit = prevApp;
} else {
- qDebug( "Startup: %s", settingsTable[currApp].app );
+ odebug << "Startup: " << settingsTable[currApp].app << "" << oendl;
QCopEnvelope e(QCString("QPE/Application/") + settingsTable[currApp].app,
settingsTable[currApp].start );
waitingForLaunch = TRUE;
}
updateButtons();
}
/* accept current dialog and bring up previous */
void FirstUse::previousDialog()
{
int prevApp = currApp;
do {
currApp--;
if ( currApp < 0 ) {
currApp = prevApp;
return;
}
} while ( !settingsTable[currApp].enabled );
if ( prevApp >= 0 ) {
- qDebug( "Shutdown: %s", settingsTable[prevApp].app );
+ odebug << "Shutdown: " << settingsTable[prevApp].app << "" << oendl;
QCopEnvelope e(QCString("QPE/Application/") + settingsTable[prevApp].app,
settingsTable[prevApp].stop );
/*
if (settingsTable[prevApp].app == QString("systemtime"))
QCopEnvelope e("QPE/Application/citytime", "close()");
*/
waitForExit = prevApp;
} else {
- qDebug( "Startup: %s", settingsTable[currApp].app );
+ odebug << "Startup: " << settingsTable[currApp].app << "" << oendl;
QCopEnvelope e(QCString("QPE/Application/") + settingsTable[currApp].app,
settingsTable[currApp].start );
waitingForLaunch = TRUE;
}
updateButtons();
}
void FirstUse::message(const QCString &msg, const QByteArray &data)
{
QDataStream stream( data, IO_ReadOnly );
if ( msg == "timeChange(QString)" ) {
QString t;
stream >> t;
if ( t.isNull() )
unsetenv("TZ");
else
setenv( "TZ", t.latin1(), 1 );
}
}
void FirstUse::terminated( int, const QString &app )
{
- qDebug( "--- terminated: %s", app.latin1() );
+ odebug << "--- terminated: " << app << "" << oendl;
if ( waitForExit != -1 && settingsTable[waitForExit].app == app ) {
- qDebug( "Startup: %s", settingsTable[currApp].app );
+ odebug << "Startup: " << settingsTable[currApp].app << "" << oendl;
if ( settingsTable[waitForExit].app == "language" ) { // No tr
Config config("locale");
config.setGroup( "Language");
QString l = config.readEntry( "Language", "en");
if ( l != lang ) {
reloadLanguages();
needRestart = TRUE;
lang = l;
}
}
QCopEnvelope e(QCString("QPE/Application/") + settingsTable[currApp].app,
settingsTable[currApp].start );
@@ -338,83 +340,83 @@ void FirstUse::terminated( int, const QString &app )
repaint();
waitForExit = -1;
} else if ( settingsTable[currApp].app == app ) {
nextDialog();
} else {
back->setEnabled(TRUE);
next->setEnabled(TRUE);
}
}
void FirstUse::newQcopChannel(const QString& channelName)
{
- qDebug("channel %s added", channelName.data() );
+ odebug << "channel " << channelName.data() << " added" << oendl;
QString prefix("QPE/Application/");
if (channelName.startsWith(prefix)) {
QString appName = channelName.mid(prefix.length());
if ( currApp >= 0 && appName == settingsTable[currApp].app ) {
- qDebug( "Application: %s started", settingsTable[currApp].app );
+ odebug << "Application: " << settingsTable[currApp].app << " started" << oendl;
waitingForLaunch = FALSE;
updateButtons();
repaint();
} else if (appName != "quicklauncher") {
back->setEnabled(FALSE);
next->setEnabled(FALSE);
}
}
}
void FirstUse::reloadLanguages()
{
// read language from config file. Waiting on QCop takes too long.
Config config("locale");
config.setGroup( "Language");
QString l = config.readEntry( "Language", "en");
QString cl = getenv("LANG");
- qWarning("language message - " + l);
+ owarn << "language message - " + l << oendl;
// setting anyway...
if (l.isNull() )
unsetenv( "LANG" );
else {
- qWarning("and its not null");
+ owarn << "and its not null" << oendl;
setenv( "LANG", l.latin1(), 1 );
}
#ifndef QT_NO_TRANSLATION
// clear old translators
#ifndef _MSC_VER
//### revise to allow removal of translators under MSVC
if(qApp->translators) {
qApp->translators->setAutoDelete(TRUE);
delete (qApp->translators);
qApp->translators = 0;
}
#endif
// load translation tables
transApp = new QTranslator(qApp);
QString tfn = QPEApplication::qpeDir() + "i18n/"+l+"/qpe.qm";
- qWarning("loading " + tfn);
+ owarn << "loading " + tfn << oendl;
if ( transApp->load(tfn) ) {
- qWarning("installing translator");
+ owarn << "installing translator" << oendl;
qApp->installTranslator( transApp );
} else {
delete transApp;
transApp = 0;
}
transLib = new QTranslator(qApp);
tfn = QPEApplication::qpeDir() + "i18n/"+l+"/libqpe.qm";
- qWarning("loading " + tfn);
+ owarn << "loading " + tfn << oendl;
if ( transLib->load(tfn) ) {
- qWarning("installing translator library");
+ owarn << "installing translator library" << oendl;
qApp->installTranslator( transLib );
} else {
delete transLib;
transLib = 0;
}
loadPixmaps();
//###language/font hack; should look it up somewhere
#ifdef Q_WS_QWS
if ( l == "ja" || l == "zh_CN" || l == "zh_TW" || l == "ko" ) {
QFont fn = FontManager::unicodeFont( FontManager::Proportional );
qApp->setFont( fn, TRUE );
} else {