author | mickeyl <mickeyl> | 2003-11-17 15:16:13 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-11-17 15:16:13 (UTC) |
commit | c4a6e9c529ea6bcb1c9a42fee33a70300f116c98 (patch) (side-by-side diff) | |
tree | 1ee68a2035b0218ba99662db1dff4c4067064cde | |
parent | 725e2723291fe1d71ca68cb59cec83428d40b8af (diff) | |
download | opie-c4a6e9c529ea6bcb1c9a42fee33a70300f116c98.zip opie-c4a6e9c529ea6bcb1c9a42fee33a70300f116c98.tar.gz opie-c4a6e9c529ea6bcb1c9a42fee33a70300f116c98.tar.bz2 |
This patch makes the famous Documents Tab customizably optional.
Note that the document tab is so tight coupled to the rest
of the launcher that it proved impossible for me to remove the
tab as is. However I could make all the scanning and the displaying
optional.
The customization can be done via the launcher settings applications -
a new doc tab category has been added. Further customization can be
added to that tab.
I also added a doc tab settings application for use with the "first usage wizard"
-rw-r--r-- | core/launcher/documentlist.cpp | 17 | ||||
-rw-r--r-- | core/launcher/firstuse.cpp | 2 | ||||
-rw-r--r-- | core/launcher/launcher.cpp | 35 | ||||
-rw-r--r-- | core/launcher/launcher.h | 2 | ||||
-rw-r--r-- | core/settings/launcher/doctabsettings.cpp | 71 | ||||
-rw-r--r-- | core/settings/launcher/doctabsettings.h | 55 | ||||
-rw-r--r-- | core/settings/launcher/inputmethodsettings.cpp | 3 | ||||
-rw-r--r-- | core/settings/launcher/launcher.pro | 2 | ||||
-rw-r--r-- | core/settings/launcher/launchersettings.cpp | 5 | ||||
-rw-r--r-- | core/settings/launcher/launchersettings.h | 2 | ||||
-rw-r--r-- | noncore/settings/doctab/.cvsignore | 4 | ||||
-rw-r--r-- | noncore/settings/doctab/config.in | 4 | ||||
-rw-r--r-- | noncore/settings/doctab/doctab.cpp | 94 | ||||
-rw-r--r-- | noncore/settings/doctab/doctab.h | 57 | ||||
-rw-r--r-- | noncore/settings/doctab/doctab.pro | 10 | ||||
-rw-r--r-- | noncore/settings/doctab/doctabsettingsbase.ui | 115 | ||||
-rw-r--r-- | noncore/settings/doctab/main.cpp | 25 | ||||
-rw-r--r-- | noncore/settings/doctab/opie-doctab.control | 10 | ||||
-rw-r--r-- | noncore/settings/language/config.in | 2 | ||||
-rw-r--r-- | noncore/settings/language/main.cpp | 2 |
20 files changed, 504 insertions, 13 deletions
diff --git a/core/launcher/documentlist.cpp b/core/launcher/documentlist.cpp index 7f9366e..dcea4b9 100644 --- a/core/launcher/documentlist.cpp +++ b/core/launcher/documentlist.cpp @@ -1,647 +1,662 @@ /********************************************************************** ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. ** ** This file is part of the Qtopia Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "documentlist.h" #include "serverinterface.h" #include "launcherglobal.h" +#include <qtopia/config.h> #include <qtopia/mimetype.h> #include <qtopia/resource.h> #include <qtopia/global.h> #include <qtopia/private/categories.h> #include <qtopia/qpeapplication.h> #include <qtopia/applnk.h> #include <qtopia/storage.h> #ifdef Q_WS_QWS #include <qtopia/qcopenvelope_qws.h> #endif #include <qtimer.h> #include <qfileinfo.h> #include <qtextstream.h> #include <qfile.h> #include <qdir.h> #include <qpainter.h> #include <qimage.h> #include <qcopchannel_qws.h> #include <qlistview.h> #include <qlist.h> #include <qpixmap.h> AppLnkSet *DocumentList::appLnkSet = 0; static const int MAX_SEARCH_DEPTH = 10; class DocumentListPrivate : public QObject { Q_OBJECT public: DocumentListPrivate( ServerInterface *gui ); ~DocumentListPrivate(); void initialize(); const QString nextFile(); const DocLnk *iterate(); bool store( DocLnk* dl ); void estimatedPercentScanned(); DocLnkSet dls; QDict<void> reference; QDictIterator<void> *dit; enum { Find, RemoveKnownFiles, MakeUnknownFiles, Done } state; QStringList docPaths; unsigned int docPathsSearched; int searchDepth; QDir *listDirs[MAX_SEARCH_DEPTH]; const QFileInfoList *lists[MAX_SEARCH_DEPTH]; unsigned int listPositions[MAX_SEARCH_DEPTH]; StorageInfo *storage; int tid; ServerInterface *serverGui; bool needToSendAllDocLinks; bool sendAppLnks; bool sendDocLnks; bool scanDocs; }; DocumentList::DocumentList( ServerInterface *serverGui, bool scanDocs, QObject *parent, const char *name ) : QObject( parent, name ) { appLnkSet = new AppLnkSet( MimeType::appsFolderName() ); d = new DocumentListPrivate( serverGui ); d->scanDocs = scanDocs; d->needToSendAllDocLinks = false; QTimer::singleShot( 10, this, SLOT( startInitialScan() ) ); } void DocumentList::startInitialScan() { reloadAppLnks(); - reloadDocLnks(); + + Config cfg( "Launcher" ); + cfg.setGroup( "DocTab" ); + bool docTabEnabled = cfg.readBoolEntry( "Enable", true ); + if ( docTabEnabled ) + reloadDocLnks(); + else + { + if ( d->sendDocLnks && d->serverGui ) + { + d->serverGui->documentScanningProgress( 0 ); + d->serverGui->allDocumentsRemoved(); + } + } + } DocumentList::~DocumentList() { delete appLnkSet; delete d; } void DocumentList::add( const DocLnk& doc ) { if ( d->serverGui && QFile::exists( doc.file() ) ) d->serverGui->documentAdded( doc ); } void DocumentList::start() { resume(); } void DocumentList::pause() { //qDebug("pause %i", d->tid); killTimer( d->tid ); d->tid = 0; } void DocumentList::resume() { if ( d->tid == 0 ) { d->tid = startTimer( 0 ); //qDebug("resumed %i", d->tid); } } /* void DocumentList::resend() { // Re-emits all the added items to the list (firstly letting everyone know to // clear what they have as it is being sent again) pause(); emit allRemoved(); QTimer::singleShot( 5, this, SLOT( resendWorker() ) ); } void DocumentList::resendWorker() { const QList<DocLnk> &list = d->dls.children(); for ( QListIterator<DocLnk> it( list ); it.current(); ++it ) add( *(*it) ); resume(); } */ void DocumentList::rescan() { //qDebug("rescan"); pause(); d->initialize(); resume(); } void DocumentList::timerEvent( QTimerEvent *te ) { if ( te->timerId() == d->tid ) { // Do 3 at a time for (int i = 0; i < 3; i++ ) { const DocLnk *lnk = d->iterate(); if ( lnk ) { add( *lnk ); } else { // stop when done pause(); if ( d->serverGui ) d->serverGui->documentScanningProgress( 100 ); if ( d->needToSendAllDocLinks ) sendAllDocLinks(); break; } } } } void DocumentList::reloadAppLnks() { if ( d->sendAppLnks && d->serverGui ) { d->serverGui->applicationScanningProgress( 0 ); d->serverGui->allApplicationsRemoved(); } delete appLnkSet; appLnkSet = new AppLnkSet( MimeType::appsFolderName() ); if ( d->sendAppLnks && d->serverGui ) { static QStringList prevTypeList; QStringList types = appLnkSet->types(); for ( QStringList::Iterator ittypes=types.begin(); ittypes!=types.end(); ++ittypes) { if ( !(*ittypes).isEmpty() ) { if ( !prevTypeList.contains(*ittypes) ) { QString name = appLnkSet->typeName(*ittypes); QPixmap pm = appLnkSet->typePixmap(*ittypes); QPixmap bgPm = appLnkSet->typeBigPixmap(*ittypes); if (pm.isNull()) { QImage img( Resource::loadImage( "UnknownDocument" ) ); pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); bgPm = img.smoothScale( AppLnk::bigIconSize(), AppLnk::bigIconSize() ); } //qDebug("adding type %s", (*ittypes).latin1()); // ### our current launcher expects docs tab to be last d->serverGui->typeAdded( *ittypes, name.isNull() ? (*ittypes) : name, pm, bgPm ); } prevTypeList.remove(*ittypes); } } for ( QStringList::Iterator ittypes=prevTypeList.begin(); ittypes!=prevTypeList.end(); ++ittypes) { //qDebug("removing type %s", (*ittypes).latin1()); d->serverGui->typeRemoved(*ittypes); } prevTypeList = types; } QListIterator<AppLnk> itapp( appLnkSet->children() ); AppLnk* l; while ( (l=itapp.current()) ) { ++itapp; if ( d->sendAppLnks && d->serverGui ) d->serverGui->applicationAdded( l->type(), *l ); } if ( d->sendAppLnks && d->serverGui ) d->serverGui->applicationScanningProgress( 100 ); } void DocumentList::reloadDocLnks() { if ( !d->scanDocs ) return; if ( d->sendDocLnks && d->serverGui ) { d->serverGui->documentScanningProgress( 0 ); d->serverGui->allDocumentsRemoved(); } rescan(); } void DocumentList::linkChanged( QString arg ) { //qDebug( "linkchanged( %s )", arg.latin1() ); if ( arg.isNull() || Opie::Global::isAppLnkFileName( arg ) ) { reloadAppLnks(); } else { const QList<DocLnk> &list = d->dls.children(); QListIterator<DocLnk> it( list ); while ( it.current() ) { DocLnk *doc = it.current(); ++it; if ( ( doc->linkFileKnown() && doc->linkFile() == arg ) || ( doc->fileKnown() && doc->file() == arg ) ) { //qDebug( "found old link" ); DocLnk* dl = new DocLnk( arg ); // add new one if it exists and matches the mimetype if ( d->store( dl ) ) { // Existing link has been changed, send old link ref and a ref // to the new link //qDebug( "change case" ); if ( d->serverGui ) d->serverGui->documentChanged( *doc, *dl ); } else { // Link has been removed or doesn't match the mimetypes any more // so we aren't interested in it, so take it away from the list //qDebug( "removal case" ); if ( d->serverGui ) d->serverGui->documentRemoved( *doc ); } d->dls.remove( doc ); // remove old link from docLnkSet delete doc; return; } } // Didn't find existing link, must be new DocLnk* dl = new DocLnk( arg ); if ( d->store( dl ) ) { // Add if it's a link we are interested in //qDebug( "add case" ); add( *dl ); } } } void DocumentList::restoreDone() { reloadAppLnks(); reloadDocLnks(); } void DocumentList::storageChanged() { // ### can implement better reloadAppLnks(); reloadDocLnks(); // ### Optimization opportunity // Could be a bit more intelligent and somehow work out which // mtab entry has changed and then only scan that and add and remove // links appropriately. // rescan(); } void DocumentList::sendAllDocLinks() { if ( d->tid != 0 ) { // We are in the middle of scanning, set a flag so // we do this when we finish our scanning d->needToSendAllDocLinks = true; return; } QString contents; Categories cats; for ( QListIterator<DocLnk> it( d->dls.children() ); it.current(); ++it ) { DocLnk *doc = it.current(); QFileInfo fi( doc->file() ); if ( !fi.exists() ) continue; bool fake = !doc->linkFileKnown(); if ( !fake ) { QFile f( doc->linkFile() ); if ( f.open( IO_ReadOnly ) ) { QTextStream ts( &f ); ts.setEncoding( QTextStream::UnicodeUTF8 ); contents += ts.read(); f.close(); } else fake = TRUE; } if (fake) { contents += "[Desktop Entry]\n"; // No tr contents += "Categories = " + // No tr cats.labels("Document View",doc->categories()).join(";") + "\n"; // No tr contents += "Name = "+doc->name()+"\n"; // No tr contents += "Type = "+doc->type()+"\n"; // No tr } contents += "File = "+doc->file()+"\n"; // No tr // (resolves path) contents += QString("Size = %1\n").arg( fi.size() ); // No tr } //qDebug( "sending length %d", contents.length() ); #ifndef QT_NO_COP QCopEnvelope e( "QPE/Desktop", "docLinks(QString)" ); e << contents; #endif //qDebug( "================ \n\n%s\n\n===============", contents.latin1() ); d->needToSendAllDocLinks = false; } DocumentListPrivate::DocumentListPrivate( ServerInterface *gui ) { storage = new StorageInfo( this ); serverGui = gui; if ( serverGui ) { sendAppLnks = serverGui->requiresApplications(); sendDocLnks = serverGui->requiresDocuments(); } else { sendAppLnks = false; sendDocLnks = false; } for ( int i = 0; i < MAX_SEARCH_DEPTH; i++ ) { listDirs[i] = 0; lists[i] = 0; listPositions[i] = 0; } initialize(); tid = 0; } void DocumentListPrivate::initialize() { // Reset dls.clear(); docPaths.clear(); reference.clear(); QDir docDir( QPEApplication::documentDir() ); if ( docDir.exists() ) docPaths += QPEApplication::documentDir(); int i = 1; const QList<FileSystem> &fs = storage->fileSystems(); QListIterator<FileSystem> it( fs ); for ( ; it.current(); ++it ) if ( (*it)->isRemovable() ) { docPaths += (*it)->path(); i++; } for ( int i = 0; i < MAX_SEARCH_DEPTH; i++ ) { if ( listDirs[i] ) { delete listDirs[i]; listDirs[i] = 0; } lists[i] = 0; listPositions[i] = 0; } docPathsSearched = 0; searchDepth = -1; state = Find; dit = 0; } DocumentListPrivate::~DocumentListPrivate() { for ( int i = 0; i < MAX_SEARCH_DEPTH; i++ ) if ( listDirs[i] ) delete listDirs[i]; delete dit; } void DocumentListPrivate::estimatedPercentScanned() { double overallProgress = 0.0; double levelWeight = 75.0; int topCount = docPaths.count(); if ( topCount > 1 ) { levelWeight = levelWeight / topCount; overallProgress += (docPathsSearched - 1) * levelWeight; } for ( int d = 0; d <= searchDepth; d++ ) { if ( listDirs[d] ) { int items = lists[d]->count(); if ( items > 1 ) { levelWeight = levelWeight / items; // Take in to account "." and ".." overallProgress += (listPositions[d] - 3) * levelWeight; } } else { break; } } // qDebug( "overallProgress: %f", overallProgress ); if ( serverGui ) serverGui->documentScanningProgress( (int)overallProgress ); } const QString DocumentListPrivate::nextFile() { while ( TRUE ) { while ( searchDepth < 0 ) { // go to next base path if ( docPathsSearched >= docPaths.count() ) { // end of base paths return QString::null; } else { QDir dir( docPaths[docPathsSearched] ); // qDebug("now using base path: %s", docPaths[docPathsSearched].latin1() ); docPathsSearched++; if ( !dir.exists( ".Qtopia-ignore" ) ) { listDirs[0] = new QDir( dir ); lists[0] = listDirs[0]->entryInfoList(); listPositions[0] = 0; searchDepth = 0; } } } const QFileInfoList *fil = lists[searchDepth]; QFileInfoList *fl = (QFileInfoList *)fil; unsigned int pos = listPositions[searchDepth]; if ( pos >= fl->count() ) { // go up a depth delete listDirs[searchDepth]; listDirs[searchDepth] = 0; lists[searchDepth] = 0; listPositions[searchDepth] = 0; searchDepth--; } else { const QFileInfo *fi = fl->at(pos); listPositions[searchDepth]++; QString bn = fi->fileName(); if ( bn[0] != '.' ) { if ( fi->isDir() ) { if ( bn != "CVS" && bn != "Qtopia" && bn != "QtPalmtop" ) { // go down a depth QDir dir( fi->filePath() ); // qDebug("now going in to path: %s", bn.latin1() ); if ( !dir.exists( ".Qtopia-ignore" ) ) { if ( searchDepth < MAX_SEARCH_DEPTH - 1) { searchDepth++; listDirs[searchDepth] = new QDir( dir ); lists[searchDepth] = listDirs[searchDepth]->entryInfoList(); listPositions[searchDepth] = 0; } } } } else { estimatedPercentScanned(); return fl->at(pos)->filePath(); } } } } return QString::null; } bool DocumentListPrivate::store( DocLnk* dl ) { // if ( dl->fileKnown() && !dl->file().isEmpty() ) { if ( dl && dl->fileKnown() ) { dls.add( dl ); // store return TRUE; } // don't store - delete delete dl; return FALSE; } #define MAGIC_NUMBER ((void*)2) const DocLnk *DocumentListPrivate::iterate() { if ( state == Find ) { //qDebug("state Find"); QString file = nextFile(); while ( !file.isNull() ) { if ( file.right(8) == ".desktop" ) { // No tr DocLnk* dl = new DocLnk( file ); if ( store(dl) ) return dl; } else { reference.insert( file, MAGIC_NUMBER ); } file = nextFile(); } state = RemoveKnownFiles; if ( serverGui ) serverGui->documentScanningProgress( 75 ); } static int iterationI; static int iterationCount; if ( state == RemoveKnownFiles ) { //qDebug("state RemoveKnownFiles"); const QList<DocLnk> &list = dls.children(); for ( QListIterator<DocLnk> it( list ); it.current(); ++it ) { reference.remove( (*it)->file() ); // ### does this need to be deleted? } dit = new QDictIterator<void>(reference); state = MakeUnknownFiles; iterationI = 0; iterationCount = dit->count(); } if ( state == MakeUnknownFiles ) { //qDebug("state MakeUnknownFiles"); for (void* c; (c=dit->current()); ++(*dit) ) { if ( c == MAGIC_NUMBER ) { DocLnk* dl = new DocLnk; QFileInfo fi( dit->currentKey() ); dl->setFile( fi.filePath() ); dl->setName( fi.baseName() ); if ( store(dl) ) { ++*dit; iterationI++; if ( serverGui ) serverGui->documentScanningProgress( 75 + (25*iterationI)/iterationCount ); return dl; } } iterationI++; } delete dit; dit = 0; state = Done; } //qDebug("state Done"); return NULL; } #include "documentlist.moc" diff --git a/core/launcher/firstuse.cpp b/core/launcher/firstuse.cpp index 57469cf..e07920f 100644 --- a/core/launcher/firstuse.cpp +++ b/core/launcher/firstuse.cpp @@ -1,519 +1,521 @@ /********************************************************************** ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. ** ** This file is part of the Qtopia Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ // 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" #include <qtopia/resource.h> #include <qtopia/qcopenvelope_qws.h> #include <qtopia/qpeapplication.h> #include <qtopia/config.h> #include <qtopia/applnk.h> #include <qtopia/mimetype.h> #include <qtopia/fontmanager.h> #include <qapplication.h> #include <qfile.h> #include <qpainter.h> #include <qcstring.h> #include <qsimplerichtext.h> #include <qcolor.h> #include <qpushbutton.h> #include <qhbox.h> #include <qlabel.h> #include <qtimer.h> #if defined( Q_WS_QWS ) #include <qwsdisplay_qws.h> #include <qgfx_qws.h> #endif #include <qwindowsystem_qws.h> #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; const char *desc; } settingsTable [] = { { FALSE, "language", "raise()", "accept()", // No tr QT_TR_NOOP("Language") }, + { FALSE, "doctab", "raise()", "accept()", // No tr + QT_TR_NOOP("DocTab") }, #ifndef Q_OS_WIN32 { FALSE, "systemtime", "raise()", "accept()", // No tr QT_TR_NOOP("Time and Date") }, #endif { FALSE, "addressbook", "editPersonalAndClose()", "accept()", // No tr QT_TR_NOOP("Personal Information") }, { FALSE, 0, 0, 0, 0 } }; FirstUse::FirstUse(QWidget* parent, const char * name, WFlags wf) : QDialog( parent, name, TRUE, wf), transApp(0), transLib(0), needCalibrate(FALSE), currApp(-1), waitForExit(-1), waitingForLaunch(FALSE), needRestart(FALSE) { ServerApplication::allowRestart = FALSE; // we force our height beyound the maximum (which we set anyway) QRect desk = qApp->desktop()->geometry(); setGeometry( 0, 0, desk.width(), desk.height() ); connect(qwsServer, SIGNAL(newChannel(const QString&)), this, SLOT(newQcopChannel(const QString&))); // Create a DocumentList so appLauncher has appLnkSet to search docList = new DocumentList( 0, FALSE ); appLauncher = new AppLauncher( this ); connect( appLauncher, SIGNAL(terminated(int, const QString&)), this, SLOT(terminated(int, const QString&)) ); // more hackery // I will be run as either the main server or as part of the main server QWSServer::setScreenSaverIntervals(0); loadPixmaps(); //check if there is a language program #ifndef Q_OS_WIN32 QString exeSuffix; #else QString exeSuffix(".exe"); #endif for ( int i = 0; settingsTable[i].app; i++ ) { QString file = QPEApplication::qpeDir() + "bin/"; file += settingsTable[i].app; file += exeSuffix; if ( QFile::exists(file) ) settingsTable[i].enabled = TRUE; } setFocusPolicy(NoFocus); taskBar = new QWidget(0, 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop | WGroupLeader); inputMethods = new InputMethods(taskBar); connect(inputMethods, SIGNAL(inputToggled(bool)), this, SLOT(calcMaxWindowRect())); back = new QPushButton(tr("<< Back"), taskBar); back->setFocusPolicy(NoFocus); connect(back, SIGNAL(clicked()), this, SLOT(previousDialog()) ); next = new QPushButton(tr("Next >>"), taskBar); next->setFocusPolicy(NoFocus); connect(next, SIGNAL(clicked()), this, SLOT(nextDialog()) ); // need to set the geom to lower corner QSize sz = inputMethods->sizeHint(); int buttonWidth = (width() - sz.width()) / 2; int x = 0; controlHeight = back->sizeHint().height(); 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"); 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(); } } Config config("locale"); config.setGroup( "Language"); lang = config.readEntry( "Language", "en"); defaultFont = font(); //###language/font hack; should look it up somewhere #ifdef Q_WS_QWS if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { QFont fn = FontManager::unicodeFont( FontManager::Proportional ); qApp->setFont( fn, TRUE ); } #endif } FirstUse::~FirstUse() { delete appLauncher; delete docList; delete taskBar; ServerApplication::allowRestart = TRUE; } void FirstUse::calcMaxWindowRect() { #ifdef Q_WS_QWS QRect wr; int displayWidth = qApp->desktop()->width(); QRect ir = inputMethods->inputRect(); if ( ir.isValid() ) { wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 ); } else { wr.setCoords( 0, 0, displayWidth-1, qApp->desktop()->height() - controlHeight-1); } #if QT_VERSION < 0x030000 QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr, QSize(qt_screen->width(),qt_screen->height())) ); #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 ); 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 ); QCopEnvelope e(QCString("QPE/Application/") + settingsTable[prevApp].app, settingsTable[prevApp].stop ); currApp = prevApp; } else { qDebug( "Done!" ); 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 ); QCopEnvelope e(QCString("QPE/Application/") + settingsTable[prevApp].app, settingsTable[prevApp].stop ); waitForExit = prevApp; } else { qDebug( "Startup: %s", settingsTable[currApp].app ); 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 ); 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 ); 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() ); if ( waitForExit != -1 && settingsTable[waitForExit].app == app ) { qDebug( "Startup: %s", settingsTable[currApp].app ); 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 ); waitingForLaunch = TRUE; updateButtons(); 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() ); 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 ); 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); // setting anyway... if (l.isNull() ) unsetenv( "LANG" ); else { qWarning("and its not null"); 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); if ( transApp->load(tfn) ) { qWarning("installing translator"); qApp->installTranslator( transApp ); } else { delete transApp; transApp = 0; } transLib = new QTranslator(qApp); tfn = QPEApplication::qpeDir() + "i18n/"+l+"/libqpe.qm"; qWarning("loading " + tfn); if ( transLib->load(tfn) ) { qWarning("installing translator library"); 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 { qApp->setFont( defaultFont, TRUE ); } #endif #endif } void FirstUse::paintEvent( QPaintEvent * ) { QPainter p( this ); p.drawPixmap(0,0, splash); QFont f = p.font(); f.setPointSize(15); f.setItalic(FALSE); f.setBold(FALSE); p.setFont(f); if ( currApp < 0 ) { drawText(p, tr( "Tap anywhere on the screen to continue." )); } else if ( settingsTable[currApp].app ) { if ( waitingForLaunch ) drawText(p, tr("Please wait, loading %1 settings.").arg(tr(settingsTable[currApp].desc)) ); } else { drawText(p, tr("Please wait...")); } } void FirstUse::loadPixmaps() { /* create background, tr so can change image with language. images will likely contain text. */ splash.convertFromImage( Resource::loadImage(tr("FirstUseBackground")) .smoothScale( width(), height() ) ); setBackgroundPixmap(splash); } void FirstUse::drawText(QPainter &p, const QString &text) { QString altered = "<CENTER>" + text + "</CENTER>"; QSimpleRichText rt(altered, p.font()); rt.setWidth(width() - 20); int h = (height() * 3) / 10; // start at 30% if (rt.height() < height() / 2) h += ((height() / 2) - rt.height()) / 2; rt.draw(&p, 10, h, QRegion(0,0, width()-20, height()), palette()); } void FirstUse::updateButtons() { if ( currApp >= 0 ) { taskBar->show(); } int i = currApp-1; while ( i >= 0 && !settingsTable[i].enabled ) i--; back->setText(tr("<< Back")); back->setEnabled( i >= 0 && !waitingForLaunch ); i = currApp+1; while ( settingsTable[i].app && !settingsTable[i].enabled ) i++; if ( !settingsTable[i].app ) next->setText(tr("Finish")); else next->setText(tr("Next >>")); next->setEnabled( !waitingForLaunch ); } void FirstUse::keyPressEvent( QKeyEvent *e ) { // Allow cancelling at first dialog, in case display is broken. if ( e->key() == Key_Escape && currApp < 0 ) QDialog::keyPressEvent(e); } void FirstUse::mouseReleaseEvent( QMouseEvent * ) { if ( currApp < 0 ) { if ( m_calHandler && needCalibrate ) { releaseMouse(); Calibrate *cal = new Calibrate; cal->exec(); delete cal; } nextDialog(); } } diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index d697c43..b312672 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp @@ -1,757 +1,780 @@ /********************************************************************** ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. ** ** This file is part of the Qtopia Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include <qtopia/global.h> #ifdef Q_WS_QWS #include <qtopia/qcopenvelope_qws.h> #endif #include <qtopia/resource.h> #include <qtopia/applnk.h> #include <qtopia/config.h> #include <qtopia/global.h> #include <qtopia/qpeapplication.h> #include <qtopia/mimetype.h> #include <qtopia/private/categories.h> //#include <qtopia/custom.h> #include <qdir.h> #ifdef Q_WS_QWS #include <qwindowsystem_qws.h> #endif #include <qtimer.h> #include <qcombobox.h> #include <qvbox.h> #include <qlayout.h> #include <qstyle.h> #include <qpushbutton.h> #include <qtabbar.h> #include <qwidgetstack.h> #include <qlayout.h> #include <qregexp.h> #include <qmessagebox.h> #include <qframe.h> #include <qpainter.h> #include <qlabel.h> #include <qtextstream.h> #include <qpopupmenu.h> #include "startmenu.h" #include "taskbar.h" #include "serverinterface.h" #include "launcherview.h" #include "launcher.h" #include "server.h" #define QTOPIA_INTERNAL_FSLP #include <qtopia/lnkproperties.h> #include <stdlib.h> #include <assert.h> #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) #include <unistd.h> #include <stdio.h> #include <sys/vfs.h> #include <mntent.h> #endif #ifdef Q_WS_QWS #include <qkeyboard_qws.h> #include <qpe/lnkproperties.h> #endif static bool isVisibleWindow( int ); //=========================================================================== LauncherTabWidget::LauncherTabWidget( Launcher* parent ) : - QVBox( parent ) + QVBox( parent ), docview( 0 ) { docLoadingWidgetEnabled = false; docLoadingWidget = 0; docLoadingWidgetProgress = 0; launcher = parent; categoryBar = new LauncherTabBar( this ); QPalette pal = categoryBar->palette(); pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); categoryBar->setPalette( pal ); stack = new QWidgetStack(this); connect( categoryBar, SIGNAL(selected(int)), this, SLOT(raiseTabWidget()) ); categoryBar->show(); stack->show(); #if defined(Q_WS_QWS) && !defined(QT_NO_COP) QCopChannel *channel = new QCopChannel( "QPE/Launcher", this ); connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), this, SLOT(launcherMessage(const QCString&, const QByteArray&)) ); connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), this, SLOT(appMessage(const QCString&, const QByteArray&))); #endif createDocLoadingWidget(); } void LauncherTabWidget::createDocLoadingWidget() { // Construct the 'doc loading widget' shown when finding documents // ### LauncherView class needs changing to be more generic so // this widget can change its background similar to the iconviews // so the background for this matches docLoadingWidget = new LauncherView( stack ); docLoadingWidget->hideIcons(); QVBox *docLoadingVBox = new QVBox( docLoadingWidget ); docLoadingVBox->setSpacing( 20 ); docLoadingVBox->setMargin( 10 ); QWidget *space1 = new QWidget( docLoadingVBox ); docLoadingVBox->setStretchFactor( space1, 1 ); QLabel *waitPixmap = new QLabel( docLoadingVBox ); waitPixmap->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, waitPixmap->sizePolicy().hasHeightForWidth() ) ); waitPixmap->setPixmap( Resource::loadPixmap( "bigwait" ) ); waitPixmap->setAlignment( int( QLabel::AlignCenter ) ); + Config cfg( "Launcher" ); + cfg.setGroup( "DocTab" ); + bool docTabEnabled = cfg.readBoolEntry( "Enable", true ); + QLabel *textLabel = new QLabel( docLoadingVBox ); - textLabel->setText( tr( "<b>Finding Documents...</b>" ) ); textLabel->setAlignment( int( QLabel::AlignCenter ) ); - docLoadingWidgetProgress = new QProgressBar( docLoadingVBox ); docLoadingWidgetProgress->setProgress( 0 ); docLoadingWidgetProgress->setCenterIndicator( TRUE ); docLoadingWidgetProgress->setBackgroundMode( NoBackground ); // No flicker setProgressStyle(); + if ( docTabEnabled ) + { + textLabel->setText( tr( "<b>Finding Documents...</b>" ) ); + } + else + { + textLabel->setText( tr( "<b>The Documents Tab<p>has been disabled.<p>" + "Use Settings->Launcher->DocTab<p>to reenable it.</b></center>" ) ); + docLoadingWidgetProgress->hide(); + } + QWidget *space2 = new QWidget( docLoadingVBox ); docLoadingVBox->setStretchFactor( space2, 1 ); - Config cfg("Launcher"); cfg.setGroup( "Tab Documents" ); // No tr setTabViewAppearance( docLoadingWidget, cfg ); stack->addWidget( docLoadingWidget, 0 ); } void LauncherTabWidget::initLayout() { layout()->activate(); docView()->setFocus(); categoryBar->showTab("Documents"); } void LauncherTabWidget::appMessage(const QCString& message, const QByteArray&) { if ( message == "nextView()" ) categoryBar->nextTab(); } void LauncherTabWidget::raiseTabWidget() { if ( categoryBar->currentView() == docView() && docLoadingWidgetEnabled ) { stack->raiseWidget( docLoadingWidget ); docLoadingWidget->updateGeometry(); } else { stack->raiseWidget( categoryBar->currentView() ); } } void LauncherTabWidget::tabProperties() { LauncherView *view = categoryBar->currentView(); QPopupMenu *m = new QPopupMenu( this ); m->insertItem( tr("Icon View"), LauncherView::Icon ); m->insertItem( tr("List View"), LauncherView::List ); m->setItemChecked( (int)view->viewMode(), TRUE ); int rv = m->exec( QCursor::pos() ); if ( rv >= 0 && rv != view->viewMode() ) { view->setViewMode( (LauncherView::ViewMode)rv ); } delete m; } void LauncherTabWidget::deleteView( const QString& id ) { LauncherTab *t = categoryBar->launcherTab(id); if ( t ) { stack->removeWidget( t->view ); delete t->view; categoryBar->removeTab( t ); } } LauncherView* LauncherTabWidget::newView( const QString& id, const QPixmap& pm, const QString& label ) { LauncherView* view = new LauncherView( stack ); connect( view, SIGNAL(clicked(const AppLnk*)), this, SIGNAL(clicked(const AppLnk*))); connect( view, SIGNAL(rightPressed(AppLnk*)), this, SIGNAL(rightPressed(AppLnk*))); int n = categoryBar->count(); stack->addWidget( view, n ); LauncherTab *tab = new LauncherTab( id, view, pm, label ); categoryBar->insertTab( tab, n-1 ); if ( id == "Documents" ) docview = view; qDebug("inserting %s at %d", id.latin1(), n-1 ); Config cfg("Launcher"); setTabAppearance( tab, cfg ); cfg.setGroup( "GUI" ); view->setBusyIndicatorType( cfg.readEntry( "BusyType", QString::null ) ); return view; } LauncherView *LauncherTabWidget::view( const QString &id ) { LauncherTab *t = categoryBar->launcherTab(id); if ( !t ) return 0; return t->view; } LauncherView *LauncherTabWidget::docView() { return docview; } void LauncherTabWidget::setLoadingWidgetEnabled( bool v ) { if ( v != docLoadingWidgetEnabled && docLoadingWidget ) { docLoadingWidgetEnabled = v; raiseTabWidget(); } } void LauncherTabWidget::setLoadingProgress( int percent ) { docLoadingWidgetProgress->setProgress( (percent / 4) * 4 ); } // ### this function could more to LauncherView void LauncherTabWidget::setTabViewAppearance( LauncherView *v, Config &cfg ) { // View QString view = cfg.readEntry( "View", "Icon" ); if ( view == "List" ) // No tr v->setViewMode( LauncherView::List ); QString bgType = cfg.readEntry( "BackgroundType", "Image" ); if ( bgType == "Image" ) { // No tr QString pm = cfg.readEntry( "BackgroundImage", "launcher/opie-background" ); v->setBackgroundType( LauncherView::Image, pm ); } else if ( bgType == "SolidColor" ) { QString c = cfg.readEntry( "BackgroundColor" ); v->setBackgroundType( LauncherView::SolidColor, c ); } else { v->setBackgroundType( LauncherView::Ruled, QString::null ); } QString textCol = cfg.readEntry( "TextColor" ); if ( textCol.isEmpty() ) v->setTextColor( QColor() ); else v->setTextColor( QColor(textCol) ); // bool customFont = cfg.readBoolEntry( "CustomFont", FALSE ); QStringList font = cfg.readListEntry( "Font", ',' ); if ( font.count() == 4 ) v->setViewFont( QFont(font[0], font[1].toInt(), font[2].toInt(), font[3].toInt()!=0) ); // ### FIXME TabColor TabTextColor } // ### Could move to LauncherTab void LauncherTabWidget::setTabAppearance( LauncherTab *tab, Config &cfg ) { cfg.setGroup( QString( "Tab %1" ).arg(tab->type) ); // No tr setTabViewAppearance( tab->view, cfg ); // Tabs QString tabCol = cfg.readEntry( "TabColor" ); if ( tabCol.isEmpty() ) tab->bgColor = QColor(); else tab->bgColor = QColor(tabCol); QString tabTextCol = cfg.readEntry( "TabTextColor" ); if ( tabTextCol.isEmpty() ) tab->fgColor = QColor(); else tab->fgColor = QColor(tabTextCol); } void LauncherTabWidget::paletteChange( const QPalette &p ) { QVBox::paletteChange( p ); QPalette pal = palette(); pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); categoryBar->setPalette( pal ); categoryBar->update(); } void LauncherTabWidget::styleChange( QStyle & ) { QTimer::singleShot( 0, this, SLOT(setProgressStyle()) ); } void LauncherTabWidget::setProgressStyle() { if (docLoadingWidgetProgress) { docLoadingWidgetProgress->setFrameShape( QProgressBar::Box ); docLoadingWidgetProgress->setFrameShadow( QProgressBar::Plain ); docLoadingWidgetProgress->setMargin( 1 ); docLoadingWidgetProgress->setLineWidth( 1 ); } } void LauncherTabWidget::setBusy(bool on) { if ( on ) currentView()->setBusy(TRUE); else { for ( int i = 0; i < categoryBar->count(); i++ ) { LauncherView *view = ((LauncherTab *)categoryBar->tab(i))->view; view->setBusy( FALSE ); } } } void LauncherTabWidget::setBusyIndicatorType( const QString& str ) { for (int i = 0; i < categoryBar->count(); i++ ) { LauncherView* view = static_cast<LauncherTab*>( categoryBar->tab(i) )->view; view->setBusyIndicatorType( str ); } } LauncherView *LauncherTabWidget::currentView(void) { return (LauncherView*)stack->visibleWidget(); } void LauncherTabWidget::launcherMessage( const QCString &msg, const QByteArray &data) { QDataStream stream( data, IO_ReadOnly ); if ( msg == "setTabView(QString,int)" ) { QString id; stream >> id; int mode; stream >> mode; if ( view(id) ) view(id)->setViewMode( (LauncherView::ViewMode)mode ); } else if ( msg == "setTabBackground(QString,int,QString)" ) { QString id; stream >> id; int mode; stream >> mode; QString pixmapOrColor; stream >> pixmapOrColor; if ( view(id) ) view(id)->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor ); if ( id == "Documents" ) docLoadingWidget->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor ); } else if ( msg == "setTextColor(QString,QString)" ) { QString id; stream >> id; QString color; stream >> color; if ( view(id) ) view(id)->setTextColor( QColor(color) ); if ( id == "Documents" ) docLoadingWidget->setTextColor( QColor(color) ); } else if ( msg == "setFont(QString,QString,int,int,int)" ) { QString id; stream >> id; QString fam; stream >> fam; int size; stream >> size; int weight; stream >> weight; int italic; stream >> italic; if ( view(id) ) { if ( !fam.isEmpty() ) { view(id)->setViewFont( QFont(fam, size, weight, italic!=0) ); qDebug( "setFont: %s, %d, %d, %d", fam.latin1(), size, weight, italic ); } else { view(id)->clearViewFont(); } } }else if ( msg == "setBusyIndicatorType(QString)" ) { QString type; stream >> type; setBusyIndicatorType( type ); }else if ( msg == "home()" ) { if ( isVisibleWindow( static_cast<QWidget*>(parent())->winId() ) ) { if (categoryBar) categoryBar->nextTab(); }else static_cast<QWidget*>(parent())->raise(); } } //--------------------------------------------------------------------------- Launcher::Launcher() : QMainWindow( 0, "PDA User Interface", QWidget::WStyle_Customize | QWidget::WGroupLeader ) { tabs = 0; tb = 0; + Config cfg( "Launcher" ); + cfg.setGroup( "DocTab" ); + docTabEnabled = cfg.readBoolEntry( "Enable", true ); } void Launcher::createGUI() { setCaption( tr("Launcher") ); // we have a pretty good idea how big we'll be setGeometry( 0, 0, qApp->desktop()->width(), qApp->desktop()->height() ); tb = new TaskBar; tabs = new LauncherTabWidget( this ); setCentralWidget( tabs ); ServerInterface::dockWidget( tb, ServerInterface::Bottom ); tb->show(); qApp->installEventFilter( this ); connect( qApp, SIGNAL(symbol()), this, SLOT(toggleSymbolInput()) ); connect( qApp, SIGNAL(numLockStateToggle()), this, SLOT(toggleNumLockState()) ); connect( qApp, SIGNAL(capsLockStateToggle()), this, SLOT(toggleCapsLockState()) ); connect( tb, SIGNAL(tabSelected(const QString&)), this, SLOT(showTab(const QString&)) ); connect( tabs, SIGNAL(selected(const QString&)), this, SLOT(viewSelected(const QString&)) ); connect( tabs, SIGNAL(clicked(const AppLnk*)), this, SLOT(select(const AppLnk*))); connect( tabs, SIGNAL(rightPressed(AppLnk*)), this, SLOT(properties(AppLnk*))); #if defined(Q_WS_QWS) && !defined(QT_NO_COP) QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); connect( sysChannel, SIGNAL(received(const QCString &, const QByteArray &)), this, SLOT(systemMessage( const QCString &, const QByteArray &)) ); #endif // all documents QImage img( Resource::loadImage( "DocsIcon" ) ); QPixmap pm; pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); // It could add this itself if it handles docs + tabs->newView("Documents", pm, tr("Documents") )->setToolsEnabled( TRUE ); - QTimer::singleShot( 0, tabs, SLOT( initLayout() ) ); + QTimer::singleShot( 0, tabs, SLOT( initLayout() ) ); qApp->setMainWidget( this ); - QTimer::singleShot( 500, this, SLOT( makeVisible() ) ); } Launcher::~Launcher() { if ( tb ) destroyGUI(); } void Launcher::makeVisible() { showMaximized(); } void Launcher::destroyGUI() { delete tb; tb = 0; delete tabs; tabs =0; } bool Launcher::eventFilter( QObject*, QEvent *ev ) { #ifdef QT_QWS_CUSTOM if ( ev->type() == QEvent::KeyPress ) { QKeyEvent *ke = (QKeyEvent *)ev; if ( ke->key() == Qt::Key_F11 ) { // menu key QWidget *active = qApp->activeWindow(); if ( active && active->isPopup() ) active->close(); else { Global::terminateBuiltin("calibrate"); // No tr tb->launchStartMenu(); } return TRUE; } } #else Q_UNUSED(ev); #endif return FALSE; } void Launcher::toggleSymbolInput() { tb->toggleSymbolInput(); } void Launcher::toggleNumLockState() { tb->toggleNumLockState(); } void Launcher::toggleCapsLockState() { tb->toggleCapsLockState(); } static bool isVisibleWindow(int wid) { #ifdef Q_WS_QWS const QList<QWSWindow> &list = qwsServer->clientWindows(); QWSWindow* w; for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { if ( w->winId() == wid ) return !w->isFullyObscured(); } #endif return FALSE; } void Launcher::viewSelected(const QString& s) { setCaption( s + tr(" - Launcher") ); } void Launcher::showTab(const QString& id) { tabs->categoryBar->showTab(id); raise(); } void Launcher::select( const AppLnk *appLnk ) { if ( appLnk->type() == "Folder" ) { // No tr // Not supported: flat is simpler for the user } else { if ( appLnk->exec().isNull() ) { int i = QMessageBox::information(this,tr("No application"), tr("<p>No application is defined for this document." "<p>Type is %1.").arg(appLnk->type()), tr("OK"), tr("View as text"), 0, 0, 1); #if 0 /* ### Fixme */ if ( i == 1 ) Global::execute(Service::app("Open/text/*"),appLnk->file()); #endif return; } tabs->setBusy(TRUE); emit executing( appLnk ); appLnk->execute(); } } void Launcher::properties( AppLnk *appLnk ) { if ( appLnk->type() == "Folder" ) { // No tr // Not supported: flat is simpler for the user } else { /* ### libqtopia FIXME also moving docLnks... */ LnkProperties prop(appLnk,0 ); prop.showMaximized(); prop.exec(); } } void Launcher::storageChanged( const QList<FileSystem> &fs ) { // ### update combo boxes if we had a combo box for the storage type } void Launcher::systemMessage( const QCString &msg, const QByteArray &data) { QDataStream stream( data, IO_ReadOnly ); if ( msg == "busy()" ) { tb->startWait(); } else if ( msg == "notBusy(QString)" ) { QString app; stream >> app; tabs->setBusy(FALSE); tb->stopWait(app); } else if (msg == "applyStyle()") { tabs->currentView()->relayout(); } } // These are the update functions from the server void Launcher::typeAdded( const QString& type, const QString& name, const QPixmap& pixmap, const QPixmap& ) { tabs->newView( type, pixmap, name ); ids.append( type ); tb->refreshStartMenu(); static bool first = TRUE; if ( first ) { first = FALSE; tabs->categoryBar->showTab(type); } tabs->view( type )->setUpdatesEnabled( FALSE ); tabs->view( type )->setSortEnabled( FALSE ); } void Launcher::typeRemoved( const QString& type ) { tabs->view( type )->removeAllItems(); tabs->deleteView( type ); ids.remove( type ); tb->refreshStartMenu(); } void Launcher::applicationAdded( const QString& type, const AppLnk& app ) { if ( app.type() == "Separator" ) // No tr return; LauncherView *view = tabs->view( type ); if ( view ) view->addItem( new AppLnk( app ), FALSE ); else qWarning("addAppLnk: No view for type %s. Can't add app %s!", type.latin1(),app.name().latin1() ); MimeType::registerApp( app ); } void Launcher::applicationRemoved( const QString& type, const AppLnk& app ) { LauncherView *view = tabs->view( type ); if ( view ) view->removeLink( app.linkFile() ); else qWarning("removeAppLnk: No view for %s!", type.latin1() ); } void Launcher::allApplicationsRemoved() { MimeType::clear(); for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) tabs->view( (*it) )->removeAllItems(); } void Launcher::documentAdded( const DocLnk& doc ) { tabs->docView()->addItem( new DocLnk( doc ), FALSE ); } void Launcher::showLoadingDocs() { tabs->docView()->hide(); } void Launcher::showDocTab() { if ( tabs->categoryBar->currentView() == tabs->docView() ) tabs->docView()->show(); } void Launcher::documentRemoved( const DocLnk& doc ) { tabs->docView()->removeLink( doc.linkFile() ); } void Launcher::documentChanged( const DocLnk& oldDoc, const DocLnk& newDoc ) { documentRemoved( oldDoc ); documentAdded( newDoc ); } void Launcher::allDocumentsRemoved() { tabs->docView()->removeAllItems(); } void Launcher::applicationStateChanged( const QString& name, ApplicationState state ) { tb->setApplicationState( name, state ); } void Launcher::applicationScanningProgress( int percent ) { switch ( percent ) { case 0: { for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) { tabs->view( (*it) )->setUpdatesEnabled( FALSE ); tabs->view( (*it) )->setSortEnabled( FALSE ); } break; } case 100: { for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) { tabs->view( (*it) )->setUpdatesEnabled( TRUE ); tabs->view( (*it) )->setSortEnabled( TRUE ); } break; } default: break; } } void Launcher::documentScanningProgress( int percent ) { + if ( !docTabEnabled ) + { + qDebug( "Launcher: document tab disabled!" ); + tabs->setLoadingProgress( 100 ); + tabs->setLoadingWidgetEnabled( TRUE ); + return; + } + switch ( percent ) { case 0: { tabs->setLoadingProgress( 0 ); tabs->setLoadingWidgetEnabled( TRUE ); tabs->docView()->setUpdatesEnabled( FALSE ); tabs->docView()->setSortEnabled( FALSE ); break; } case 100: { tabs->docView()->updateTools(); tabs->docView()->setSortEnabled( TRUE ); tabs->docView()->setUpdatesEnabled( TRUE ); tabs->setLoadingWidgetEnabled( FALSE ); break; } default: tabs->setLoadingProgress( percent ); break; } } diff --git a/core/launcher/launcher.h b/core/launcher/launcher.h index 2917027..1d046ee 100644 --- a/core/launcher/launcher.h +++ b/core/launcher/launcher.h @@ -1,155 +1,157 @@ /********************************************************************** ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. ** ** This file is part of the Qtopia Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #ifndef LAUNCHER_H #define LAUNCHER_H #include <qtopia/config.h> #include <qtopia/storage.h> #include <qtopia/applnk.h> #include <qmainwindow.h> #include <qstringlist.h> #include <qprogressbar.h> #include <qvbox.h> #include <qlist.h> #include <qdict.h> #include "launcherview.h" #include "launchertab.h" #include "serverinterface.h" class QWidgetStack; class TaskBar; class Launcher; class LauncherTabWidget : public QVBox { // can't use a QTabWidget, since it won't let us set the frame style. Q_OBJECT public: LauncherTabWidget( Launcher* parent ); void updateDocs(AppLnkSet* docFolder); void setBusy(bool on); LauncherView *currentView(void); LauncherView* newView( const QString&, const QPixmap& pm, const QString& label ); void deleteView( const QString& ); void setTabViewAppearance( LauncherView *v, Config &cfg ); void setTabAppearance( LauncherTab *, Config &cfg ); LauncherView *view( const QString & ); LauncherView *docView(); void createDocLoadingWidget(); void setLoadingWidgetEnabled( bool v ); void setLoadingProgress( int percent ); LauncherTabBar* categoryBar; void setBusyIndicatorType( const QString& type ); signals: void selected(const QString&); void clicked(const AppLnk*); void rightPressed(AppLnk*); protected slots: void raiseTabWidget(); void tabProperties(); void initLayout(); private slots: void launcherMessage( const QCString &, const QByteArray &); void appMessage( const QCString &, const QByteArray &); void setProgressStyle(); protected: void paletteChange( const QPalette &p ); void styleChange( QStyle & ); private: Launcher *launcher; LauncherView *docview; QWidgetStack *stack; LauncherView *docLoadingWidget; QProgressBar *docLoadingWidgetProgress; bool docLoadingWidgetEnabled; }; class Launcher : public QMainWindow, public ServerInterface { Q_OBJECT public: Launcher(); ~Launcher(); // implementing ServerInterface void createGUI(); void destroyGUI(); void typeAdded( const QString& type, const QString& name, const QPixmap& pixmap, const QPixmap& bgPixmap ); void typeRemoved( const QString& type ); void applicationAdded( const QString& type, const AppLnk& doc ); void applicationRemoved( const QString& type, const AppLnk& doc ); void allApplicationsRemoved(); void applicationStateChanged( const QString& name, ApplicationState state ); void documentAdded( const DocLnk& doc ); void documentRemoved( const DocLnk& doc ); void allDocumentsRemoved(); void documentChanged( const DocLnk& oldDoc, const DocLnk& newDoc ); void storageChanged( const QList<FileSystem> & ); void applicationScanningProgress( int percent ); void documentScanningProgress( int percent ); bool requiresApplications() const { return TRUE; } bool requiresDocuments() const { return TRUE; } void showLoadingDocs(); void showDocTab(); QStringList idList() const { return ids; } public slots: void viewSelected(const QString&); void showTab(const QString&); void select( const AppLnk * ); void properties( AppLnk * ); void makeVisible(); signals: void executing( const AppLnk * ); private slots: void systemMessage( const QCString &, const QByteArray &); void toggleSymbolInput(); void toggleNumLockState(); void toggleCapsLockState(); protected: bool eventFilter( QObject *o, QEvent *ev ); private: void updateApps(); void loadDocs(); void updateDocs(); void updateTabs(); LauncherTabWidget *tabs; QStringList ids; TaskBar *tb; + + bool docTabEnabled; }; #endif // LAUNCHERVIEW_H diff --git a/core/settings/launcher/doctabsettings.cpp b/core/settings/launcher/doctabsettings.cpp new file mode 100644 index 0000000..8077b8c --- a/dev/null +++ b/core/settings/launcher/doctabsettings.cpp @@ -0,0 +1,71 @@ +/* + This file is part of the OPIE Project + =. Copyright (c) 2002 Trolltech AS <info@trolltech.com> + .=l. Copyright (c) 2003 Michael Lauer <mickeyl@handhelds.org> + .>+-= + _;:, .> :=|. This file is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU General Public +.="- .-=="i, .._ License as published by the Free Software + - . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This file is distributed in the hope that + + . -:. = it will be useful, but WITHOUT ANY WARRANTY; + : .. .:, . . . without even the implied warranty of + =_ + =;=|` MERCHANTABILITY or FITNESS FOR A + _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General +..}^=.= = ; Public License for more details. +++= -. .` .: + : = ...= . :.=- You should have received a copy of the GNU + -. .:....=;==+<; General Public License along with this file; + -_. . . )=. = see the file COPYING. If not, write to the + -- :-=` Free Software Foundation, Inc., + 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + +*/ + +#include "doctabsettings.h" + +#include <qpe/config.h> +#include <qpe/qlibrary.h> +#include <qpe/qpeapplication.h> + +#include <qspinbox.h> +#include <qcheckbox.h> +#include <qlayout.h> +#include <qlabel.h> +#include <qwhatsthis.h> + +DocTabSettings::DocTabSettings( QWidget *parent, const char *name ):QWidget( parent, name ) +{ + QBoxLayout *lay = new QVBoxLayout( this, 4, 4 ); + + _enable = new QCheckBox( tr( "Enable the Documents Tab" ), this ); + + Config cfg( "Launcher" ); + cfg.setGroup( "DocTab" ); + _enable->setChecked( cfg.readBoolEntry( "Enable", true ) ); + + lay->addWidget( _enable ); + lay->addWidget( new QLabel( tr( "<b>Note:</b> Changing these settings may need restarting Opie to become effective." ), this ) ); + + lay->addStretch(); + + QWhatsThis::add( _enable, tr( "Check, if you want the Documents Tab to be visible." ) ); +} + +void DocTabSettings::appletChanged() +{ +} + +void DocTabSettings::accept() +{ + qDebug( "DocTabSettings::accept()" ); + Config cfg( "Launcher" ); + cfg.setGroup( "DocTab" ); + cfg.writeEntry( "Enable", _enable->isChecked() ); + cfg.write(); +} + diff --git a/core/settings/launcher/doctabsettings.h b/core/settings/launcher/doctabsettings.h new file mode 100644 index 0000000..ad6447c --- a/dev/null +++ b/core/settings/launcher/doctabsettings.h @@ -0,0 +1,55 @@ +/* + =. This file is part of the OPIE Project + .=l. Copyright (c) 2003 Michael Lauer <mickeyl@handhelds.org> + .>+-= + _;:, .> :=|. This file is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU General Public +.="- .-=="i, .._ License as published by the Free Software + - . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This file is distributed in the hope that + + . -:. = it will be useful, but WITHOUT ANY WARRANTY; + : .. .:, . . . without even the implied warranty of + =_ + =;=|` MERCHANTABILITY or FITNESS FOR A + _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General +..}^=.= = ; Public License for more details. +++= -. .` .: + : = ...= . :.=- You should have received a copy of the GNU + -. .:....=;==+<; General Public License along with this file; + -_. . . )=. = see the file COPYING. If not, write to the + -- :-=` Free Software Foundation, Inc., + 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + +*/ + +#ifndef __DOCTAB_SETTINGS_H__ +#define __DOCTAB_SETTINGS_H__ + +#include <qwidget.h> + +class QCheckBox; +class QSpinBox; + +class DocTabSettings : public QWidget +{ + Q_OBJECT + + public: + DocTabSettings ( QWidget *parent = 0, const char *name = 0 ); + + void accept ( ); + + protected slots: + void appletChanged ( ); + + protected: + void init ( ); + + private: + QCheckBox* _enable; +}; + +#endif diff --git a/core/settings/launcher/inputmethodsettings.cpp b/core/settings/launcher/inputmethodsettings.cpp index 1aa1ae8..147a00d 100644 --- a/core/settings/launcher/inputmethodsettings.cpp +++ b/core/settings/launcher/inputmethodsettings.cpp @@ -1,87 +1,86 @@ /* This file is part of the OPIE Project =. Copyright (c) 2002 Trolltech AS <info@trolltech.com> .=l. Copyright (c) 2003 Michael Lauer <mickeyl@handhelds.org> .>+-= _;:, .> :=|. This file is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This file is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General ..}^=.= = ; Public License for more details. ++= -. .` .: : = ...= . :.=- You should have received a copy of the GNU -. .:....=;==+<; General Public License along with this file; -_. . . )=. = see the file COPYING. If not, write to the -- :-=` Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "inputmethodsettings.h" #include <qpe/config.h> #include <qpe/qlibrary.h> #include <qpe/qpeapplication.h> #include <qspinbox.h> #include <qcheckbox.h> #include <qlayout.h> #include <qlabel.h> #include <qwhatsthis.h> InputMethodSettings::InputMethodSettings( QWidget *parent, const char *name ):QWidget( parent, name ) { QBoxLayout *lay = new QVBoxLayout( this, 4, 4 ); _resize = new QCheckBox( tr( "Resize application on Popup" ), this ); _float = new QCheckBox( tr( "Enable floating and resizing" ), this ); - QHBoxLayout* hbox = new QHBoxLayout( this, 4, 4 ); + QHBoxLayout* hbox = new QHBoxLayout( lay, 4 ); hbox->addWidget( new QLabel( "Initial Width:", this ) ); _size = new QSpinBox( 10, 100, 10, this ); _size->setSuffix( "%" ); hbox->addWidget( _size ); hbox->addStretch(); Config cfg( "Launcher" ); cfg.setGroup( "InputMethods" ); _resize->setChecked( cfg.readBoolEntry( "Resize", true ) ); _float->setChecked( cfg.readBoolEntry( "Float", false ) ); _size->setValue( cfg.readNumEntry( "Width", 100 ) ); lay->addWidget( _resize ); lay->addWidget( _float ); - lay->addLayout( hbox ); lay->addWidget( new QLabel( tr( "<b>Note:</b> Changing these settings may need restarting Opie to become effective." ), this ) ); lay->addStretch(); QWhatsThis::add( _resize, tr( "Check, if you want the application to be automatically resized if the input method pops up." ) ); QWhatsThis::add( _float, tr( "Check, if you want to move and/or resize input methods" ) ); QWhatsThis::add( _size, tr( "Specify the percentage of the screen width for the input method" ) ); } void InputMethodSettings::appletChanged() { } void InputMethodSettings::accept() { qDebug( "InputMethodSettings::accept()" ); Config cfg( "Launcher" ); cfg.setGroup( "InputMethods" ); cfg.writeEntry( "Resize", _resize->isChecked() ); cfg.writeEntry( "Float", _float->isChecked() ); cfg.writeEntry( "Width", _size->value() ); cfg.write(); } diff --git a/core/settings/launcher/launcher.pro b/core/settings/launcher/launcher.pro index 9d05832..3261ee8 100644 --- a/core/settings/launcher/launcher.pro +++ b/core/settings/launcher/launcher.pro @@ -1,26 +1,28 @@ CONFIG += qt warn_on release quick-app HEADERS = launchersettings.h \ tabssettings.h \ taskbarsettings.h \ menusettings.h \ inputmethodsettings.h \ + doctabsettings.h \ tabconfig.h \ tabdialog.h SOURCES = main.cpp \ launchersettings.cpp \ tabssettings.cpp \ taskbarsettings.cpp \ menusettings.cpp \ inputmethodsettings.cpp \ + doctabsettings.cpp \ tabdialog.cpp INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lopie TARGET = launchersettings include ( $(OPIEDIR)/include.pro ) diff --git a/core/settings/launcher/launchersettings.cpp b/core/settings/launcher/launchersettings.cpp index efc4a86..e129849 100644 --- a/core/settings/launcher/launchersettings.cpp +++ b/core/settings/launcher/launchersettings.cpp @@ -1,77 +1,80 @@ /* =. This file is part of the OPIE Project .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> .>+-= _;:, .> :=|. This file is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This file is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General ..}^=.= = ; Public License for more details. ++= -. .` .: : = ...= . :.=- You should have received a copy of the GNU -. .:....=;==+<; General Public License along with this file; -_. . . )=. = see the file COPYING. If not, write to the -- :-=` Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <qlayout.h> #include <qapplication.h> #include <opie/otabwidget.h> #include "launchersettings.h" #include "tabssettings.h" #include "menusettings.h" #include "taskbarsettings.h" #include "inputmethodsettings.h" +#include "doctabsettings.h" LauncherSettings::LauncherSettings (QWidget*,const char*, WFlags) : QDialog ( 0, "LauncherSettings", false, WStyle_ContextHelp ) { setCaption ( tr( "Launcher Settings" )); QVBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); OTabWidget *tw = new OTabWidget ( this, "otab" ); lay-> addWidget ( tw ); m_tabs = new TabsSettings ( tw ); m_taskbar = new TaskbarSettings ( tw ); m_menu = new MenuSettings ( tw ); m_imethods = new InputMethodSettings ( tw ); + m_doctab = new DocTabSettings ( tw ); tw-> addTab ( m_taskbar, "wait", tr( "Taskbar" )); tw-> addTab ( m_menu, "go", tr( "O-Menu" )); tw-> addTab ( m_tabs, "launchersettings/tabstab.png", tr( "Tabs" )); tw-> addTab ( m_imethods, "launchersettings/inputmethod.png", tr( "InputMethods" )); - + tw-> addTab ( m_doctab, "DocsIcon", tr( "DocTab" ) ); tw-> setCurrentTab ( m_taskbar ); } void LauncherSettings::accept ( ) { m_taskbar-> accept ( ); m_menu-> accept ( ); m_tabs-> accept ( ); m_imethods-> accept ( ); + m_doctab-> accept ( ); QDialog::accept ( ); } void LauncherSettings::done ( int r ) { QDialog::done ( r ); close ( ); } diff --git a/core/settings/launcher/launchersettings.h b/core/settings/launcher/launchersettings.h index 7458d8b..9ba2942 100644 --- a/core/settings/launcher/launchersettings.h +++ b/core/settings/launcher/launchersettings.h @@ -1,55 +1,57 @@ /* =. This file is part of the OPIE Project .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> .>+-= _;:, .> :=|. This file is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This file is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General ..}^=.= = ; Public License for more details. ++= -. .` .: : = ...= . :.=- You should have received a copy of the GNU -. .:....=;==+<; General Public License along with this file; -_. . . )=. = see the file COPYING. If not, write to the -- :-=` Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __LAUNCHER_SETTINGS_H__ #define __LAUNCHER_SETTINGS_H__ #include <qdialog.h> class TabsSettings; class TaskbarSettings; class MenuSettings; class InputMethodSettings; +class DocTabSettings; class LauncherSettings : public QDialog { Q_OBJECT public: static QString appName() { return QString::fromLatin1("launchersettings"); } LauncherSettings (QWidget *parent = 0, const char* name = 0, WFlags fl = 0 ); virtual void accept ( ); virtual void done ( int r ); private: TabsSettings *m_tabs; TaskbarSettings *m_taskbar; MenuSettings *m_menu; InputMethodSettings* m_imethods; + DocTabSettings *m_doctab; }; #endif diff --git a/noncore/settings/doctab/.cvsignore b/noncore/settings/doctab/.cvsignore new file mode 100644 index 0000000..50a4b1c --- a/dev/null +++ b/noncore/settings/doctab/.cvsignore @@ -0,0 +1,4 @@ +Makefile* +languagesettingsbase.cpp +languagesettingsbase.h +moc_* diff --git a/noncore/settings/doctab/config.in b/noncore/settings/doctab/config.in new file mode 100644 index 0000000..5decda5 --- a/dev/null +++ b/noncore/settings/doctab/config.in @@ -0,0 +1,4 @@ + config DOCTAB + boolean "opie-doctab (select doctab for Opie)" + default "y" + depends ( LIBQPE || LIBQPE-X11 ) diff --git a/noncore/settings/doctab/doctab.cpp b/noncore/settings/doctab/doctab.cpp new file mode 100644 index 0000000..feaf538 --- a/dev/null +++ b/noncore/settings/doctab/doctab.cpp @@ -0,0 +1,94 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qtopia Environment. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "doctab.h" + +#include <qpe/global.h> +#include <qpe/fontmanager.h> +#include <qpe/config.h> +#include <qpe/applnk.h> +#include <qpe/qpedialog.h> +#include <qpe/qpeapplication.h> +#if defined(Q_WS_QWS) && !defined(QT_NO_COP) +#include <qpe/qcopenvelope_qws.h> +#endif + +#include <qlabel.h> +#include <qcheckbox.h> +#include <qradiobutton.h> +#include <qtabwidget.h> +#include <qslider.h> +#include <qfile.h> +#include <qtextstream.h> +#include <qdatastream.h> +#include <qmessagebox.h> +#include <qcombobox.h> +#include <qspinbox.h> +#include <qlistbox.h> +#include <qdir.h> +#if QT_VERSION >= 300 +#include <qstylefactory.h> +#endif + +#include <stdlib.h> + + +DocTabSettings::DocTabSettings( QWidget* parent, const char* name, WFlags fl ) + : DocTabSettingsBase( parent, name, TRUE, fl ) +{ + dl = new QPEDialogListener(this); + reset(); +} + +DocTabSettings::~DocTabSettings() +{} + +void DocTabSettings::accept() +{ + applyDocTab(); + QDialog::accept(); +} + +void DocTabSettings::applyDocTab() +{ + Config cfg( "Launcher" ); + cfg.setGroup( "DocTab" ); + cfg.writeEntry( "Enable", yes->isChecked() ); + cfg.write(); +} + + +void DocTabSettings::reject() +{ + reset(); + QDialog::reject(); +} + +void DocTabSettings::reset() +{ +} + +QString DocTabSettings::actualDocTab; + +void DocTabSettings::done(int r) +{ + QDialog::done(r); + close(); +} diff --git a/noncore/settings/doctab/doctab.h b/noncore/settings/doctab/doctab.h new file mode 100644 index 0000000..ed71978 --- a/dev/null +++ b/noncore/settings/doctab/doctab.h @@ -0,0 +1,57 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qtopia Environment. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ +#ifndef DOCTAB_H +#define DOCTAB_H + + +#include <qstrlist.h> +#include <qasciidict.h> +#include "doctabsettingsbase.h" + +class QPEDialogListener; + +class DocTabSettings : public DocTabSettingsBase +{ + Q_OBJECT + +public: + DocTabSettings( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DocTabSettings(); + + static QString appName() { return QString::fromLatin1("doctab"); } + +protected: + void accept(); + void reject(); + void done(int); + +private slots: + void applyDocTab(); + void reset(); + +private: + static QString actualDocTab; + + QPEDialogListener *dl; +}; + + +#endif // SETTINGS_H + diff --git a/noncore/settings/doctab/doctab.pro b/noncore/settings/doctab/doctab.pro new file mode 100644 index 0000000..d12ac2d --- a/dev/null +++ b/noncore/settings/doctab/doctab.pro @@ -0,0 +1,10 @@ +CONFIG += qt warn_on release quick-app +HEADERS = doctab.h +SOURCES = doctab.cpp main.cpp +INTERFACES = doctabsettingsbase.ui +INCLUDEPATH += $(OPIEDIR)/include +DEPENDPATH += ../$(OPIEDIR)/include +LIBS += -lqpe +TARGET = doctab + +include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/settings/doctab/doctabsettingsbase.ui b/noncore/settings/doctab/doctabsettingsbase.ui new file mode 100644 index 0000000..e3bb39b --- a/dev/null +++ b/noncore/settings/doctab/doctabsettingsbase.ui @@ -0,0 +1,115 @@ +<!DOCTYPE UI><UI> +<class>DocTabSettingsBase</class> +<widget> + <class>QDialog</class> + <property stdset="1"> + <name>name</name> + <cstring>DocTabSettingsBase</cstring> + </property> + <property stdset="1"> + <name>geometry</name> + <rect> + <x>0</x> + <y>0</y> + <width>273</width> + <height>293</height> + </rect> + </property> + <property stdset="1"> + <name>caption</name> + <string>DocTab Settings</string> + </property> + <vbox> + <property stdset="1"> + <name>margin</name> + <number>11</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget> + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>TextLabel1</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string><b>Do you want a Documents Tab?</b><p> +(Note that such a tab scans <i>all</i> documents +on <i>all</i> external media, which can be quite +slow and annyoing...)</string> + </property> + </widget> + <widget> + <class>QButtonGroup</class> + <property stdset="1"> + <name>name</name> + <cstring>ButtonGroup1</cstring> + </property> + <property stdset="1"> + <name>title</name> + <string>Enable the DocTab</string> + </property> + <vbox> + <property stdset="1"> + <name>margin</name> + <number>11</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget> + <class>QRadioButton</class> + <property stdset="1"> + <name>name</name> + <cstring>yes</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Yes, please!</string> + </property> + <property stdset="1"> + <name>checked</name> + <bool>true</bool> + </property> + </widget> + <widget> + <class>QRadioButton</class> + <property stdset="1"> + <name>name</name> + <cstring>no</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>No, thanks.</string> + </property> + </widget> + </vbox> + </widget> + <spacer> + <property> + <name>name</name> + <cstring>Spacer1</cstring> + </property> + <property stdset="1"> + <name>orientation</name> + <enum>Vertical</enum> + </property> + <property stdset="1"> + <name>sizeType</name> + <enum>Expanding</enum> + </property> + <property> + <name>sizeHint</name> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </vbox> +</widget> +</UI> diff --git a/noncore/settings/doctab/main.cpp b/noncore/settings/doctab/main.cpp new file mode 100644 index 0000000..bfeb2a3 --- a/dev/null +++ b/noncore/settings/doctab/main.cpp @@ -0,0 +1,25 @@ +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qtopia Environment. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "settings.h" + +#include <opie/oapplicationfactory.h> + +OPIE_EXPORT_APP( OApplicationFactory<DocTabSettings> ) diff --git a/noncore/settings/doctab/opie-doctab.control b/noncore/settings/doctab/opie-doctab.control new file mode 100644 index 0000000..9951561 --- a/dev/null +++ b/noncore/settings/doctab/opie-doctab.control @@ -0,0 +1,10 @@ +Package: opie-doctab +Files: plugins/application/libdoctab.so* bin/doctab apps/Settings/DocTab.desktop +Priority: optional +Section: opie/settings +Maintainer: The Opie Team <opie-devel@handhelds.org> +Architecture: arm +Depends: task-opie-minimal +Description: DocTab settings dialog + For the Opie environment. +Version: $QPE_VERSION$EXTRAVERSION diff --git a/noncore/settings/language/config.in b/noncore/settings/language/config.in index dbdfdab..489d11c 100644 --- a/noncore/settings/language/config.in +++ b/noncore/settings/language/config.in @@ -1,4 +1,4 @@ config LANGUAGE boolean "opie-language (select language for Opie)" default "y" - depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE + depends ( LIBQPE || LIBQPE-X11 ) diff --git a/noncore/settings/language/main.cpp b/noncore/settings/language/main.cpp index 8bdf8a5..709a3f8 100644 --- a/noncore/settings/language/main.cpp +++ b/noncore/settings/language/main.cpp @@ -1,27 +1,25 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of Qtopia Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "settings.h" -#include <qpe/qpeapplication.h> #include <opie/oapplicationfactory.h> - OPIE_EXPORT_APP( OApplicationFactory<LanguageSettings> ) |