author | zecke <zecke> | 2002-04-27 17:59:11 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-04-27 17:59:11 (UTC) |
commit | 5db1fbe485f5e8a1a455d7c8d602695e13db3a97 (patch) (side-by-side diff) | |
tree | 191561593a37f2ea276c55a67090b2a1c93044e4 | |
parent | f3ee6db944094c61ecf803f07ff736bf6d70141d (diff) | |
download | opie-5db1fbe485f5e8a1a455d7c8d602695e13db3a97.zip opie-5db1fbe485f5e8a1a455d7c8d602695e13db3a97.tar.gz opie-5db1fbe485f5e8a1a455d7c8d602695e13db3a97.tar.bz2 |
remove the dependency of libopie
-rw-r--r-- | core/launcher/launcher.cpp | 2 | ||||
-rw-r--r-- | core/launcher/launcher.pro | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index 1a52f69..a0f04f1 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp @@ -1,410 +1,410 @@ /********************************************************************** ** Copyright (c) 2002 Holger zecke Freyther ** 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. ** **********************************************************************/ // WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT // have this class. #define QTOPIA_INTERNAL_FSLP -#include <opie/oconfig.h> +#include <qpe/config.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/resource.h> #include <qpe/applnk.h> #include <qpe/config.h> #include <qpe/global.h> #include <qpe/qpeapplication.h> #include <qpe/mimetype.h> #include <qpe/storage.h> #include <qpe/palmtoprecord.h> #include <qdatetime.h> #include <qdir.h> #include <qwindowsystem_qws.h> #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 "launcherview.h" #include "launcher.h" #include "syncdialog.h" #include "desktop.h" #include <qpe/lnkproperties.h> #include "mrulist.h" #include "qrsync.h" #include <stdlib.h> #include <unistd.h> #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) #include <stdio.h> #include <sys/vfs.h> #include <mntent.h> #endif #include <qpe/storage.h> #include "mediummountgui.h" //#define SHOW_ALL // uidGen // uidGen namespace { QStringList configToMime( Config *cfg ){ QStringList mimes; bool tmpMime = true; cfg->setGroup("mimetypes" ); tmpMime = cfg->readBoolEntry("all" ,true); if( tmpMime ){ mimes << QString::null; return mimes; }else{ tmpMime = cfg->readBoolEntry("audio", true ); if(tmpMime ) mimes.append("audio/*" ); tmpMime = cfg->readBoolEntry("image", true ); if(tmpMime ) mimes.append("image/*" ); tmpMime = cfg->readBoolEntry("text", true ); if(tmpMime ) mimes.append("text/*"); tmpMime = cfg->readBoolEntry("video", true ); if(tmpMime ) mimes.append("video/*" ); } return mimes; } } CategoryTabWidget::CategoryTabWidget( QWidget* parent ) : QVBox( parent ) { categoryBar = 0; stack = 0; } void CategoryTabWidget::prevTab() { if ( categoryBar ) { int n = categoryBar->count(); int tab = categoryBar->currentTab(); if ( tab >= 0 ) categoryBar->setCurrentTab( (tab - 1 + n)%n ); } } void CategoryTabWidget::nextTab() { if ( categoryBar ) { int n = categoryBar->count(); int tab = categoryBar->currentTab(); categoryBar->setCurrentTab( (tab + 1)%n ); } } void CategoryTabWidget::addItem( const QString& linkfile ) { int i=0; AppLnk *app = new AppLnk(linkfile); if ( !app->isValid() ) { delete app; return; } if ( !app->file().isEmpty() ) { // A document delete app; app = new DocLnk(linkfile); ((LauncherView*)(stack->widget(ids.count()-1)))->addItem(app); return; } for ( QStringList::Iterator it=ids.begin(); it!=ids.end(); ++it) { if ( !(*it).isEmpty() ) { QRegExp tf(*it,FALSE,TRUE); if ( tf.match(app->type()) >= 0 ) { ((LauncherView*)stack->widget(i))->addItem(app); return; } i++; } } } void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, AppLnkSet* docFolder, const QList<FileSystem> &fs) { delete categoryBar; categoryBar = new CategoryTabBar( 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 ); delete stack; stack = new QWidgetStack(this); tabs=0; ids.clear(); QStringList types = rootFolder->types(); for ( QStringList::Iterator it=types.begin(); it!=types.end(); ++it) { if ( !(*it).isEmpty() ) { newView(*it,rootFolder->typePixmap(*it),rootFolder->typeName(*it)); } } QListIterator<AppLnk> it( rootFolder->children() ); AppLnk* l; while ( (l=it.current()) ) { if ( l->type() == "Separator" ) { rootFolder->remove(l); delete l; } else { int i=0; for ( QStringList::Iterator it=types.begin(); it!=types.end(); ++it) { if ( *it == l->type() ) ((LauncherView*)stack->widget(i))->addItem(l,FALSE); i++; } } ++it; } rootFolder->detachChildren(); for (int i=0; i<tabs; i++) ((LauncherView*)stack->widget(i))->sort(); // all documents docview = newView( QString::null, Resource::loadPixmap("DocsIcon"), tr("Documents")); docview->populate( docFolder, QString::null ); docFolder->detachChildren(); docview->setFileSystems(fs); docview->setToolsEnabled(TRUE); connect( categoryBar, SIGNAL(selected(int)), stack, SLOT(raiseWidget(int)) ); ((LauncherView*)stack->widget(0))->setFocus(); categoryBar->show(); stack->show(); } void CategoryTabWidget::updateDocs(AppLnkSet* docFolder, const QList<FileSystem> &fs) { docview->populate( docFolder, QString::null ); docFolder->detachChildren(); docview->setFileSystems(fs); docview->updateTools(); } LauncherView* CategoryTabWidget::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*))); ids.append(id); categoryBar->addTab( new QTab( pm, label ) ); stack->addWidget( view, tabs++ ); return view; } void CategoryTabWidget::updateLink(const QString& linkfile) { int i=0; LauncherView* view; while ((view = (LauncherView*)stack->widget(i++))) { if ( view->removeLink(linkfile) ) break; } addItem(linkfile); docview->updateTools(); } void CategoryTabWidget::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 CategoryTabWidget::setBusy(bool on) { if ( on ) ((LauncherView*)stack->visibleWidget())->setBusy(TRUE); else for (int i=0; i<tabs; i++) ((LauncherView*)stack->widget(i))->setBusy(FALSE); } CategoryTabBar::CategoryTabBar( QWidget *parent, const char *name ) : QTabBar( parent, name ) { setFocusPolicy( NoFocus ); connect( this, SIGNAL( selected(int) ), this, SLOT( layoutTabs() ) ); } CategoryTabBar::~CategoryTabBar() { } void CategoryTabBar::layoutTabs() { if ( !count() ) return; // int percentFalloffTable[] = { 100, 70, 40, 12, 6, 3, 1, 0 }; int hiddenTabWidth = -12; int middleTab = currentTab(); int hframe, vframe, overlap; style().tabbarMetrics( this, hframe, vframe, overlap ); QFontMetrics fm = fontMetrics(); int x = 0; QRect r; QTab *t; int available = width()-1; int required = 0; for ( int i = 0; i < count(); i++ ) { t = tab(i); // if (( i < (middleTab - 1) ) || ( i > (middleTab + 1) )) { if ( i != middleTab ) { // required += hiddenTabWidth + hframe - overlap; available -= hiddenTabWidth + hframe - overlap; if ( t->iconSet() != 0 ) available -= t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); } else { required += fm.width( t->text() ) + hframe - overlap; if ( t->iconSet() != 0 ) required += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); } } for ( int i = 0; i < count(); i++ ) { t = tab(i); // if (( i < (middleTab - 1) ) || ( i > (middleTab + 1) )) { if ( i != middleTab ) { int w = hiddenTabWidth; int ih = 0; if ( t->iconSet() != 0 ) { w += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); } int h = QMAX( fm.height(), ih ); h = QMAX( h, QApplication::globalStrut().height() ); h += vframe; w += hframe; t->setRect( QRect(x, 0, w, h) ); x += t->rect().width() - overlap; r = r.unite( t->rect() ); } else { int w = fm.width( t->text() ); int ih = 0; if ( t->iconSet() != 0 ) { w += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); } int h = QMAX( fm.height(), ih ); h = QMAX( h, QApplication::globalStrut().height() ); h += vframe; w += hframe; // t->setRect( QRect(x, 0, w * available/required, h) ); t->setRect( QRect(x, 0, available, h) ); x += t->rect().width() - overlap; r = r.unite( t->rect() ); } } QRect rr = tab(count()-1)->rect(); rr.setRight(width()-1); tab(count()-1)->setRect( rr ); for ( t = tabList()->first(); t; t = tabList()->next() ) { QRect tr = t->rect(); tr.setHeight( r.height() ); t->setRect( tr ); } update(); } void CategoryTabBar::paint( QPainter * p, QTab * t, bool selected ) const { #if QT_VERSION >= 300 QStyle::SFlags flags = QStyle::Style_Default; if ( selected ) flags |= QStyle::Style_Selected; style().drawControl( QStyle::CE_TabBarTab, p, this, t->rect(), colorGroup(), flags, QStyleOption(t) ); #else style().drawTab( p, this, t, selected ); #endif QRect r( t->rect() ); QFont f( font() ); if ( selected ) f.setBold( TRUE ); p->setFont( f ); int iw = 0; int ih = 0; if ( t->iconSet() != 0 ) { iw = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width() + 2; ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); } int w = iw + p->fontMetrics().width( t->text() ) + 4; int h = QMAX(p->fontMetrics().height() + 4, ih ); paintLabel( p, QRect( r.left() + (r.width()-w)/2 - 3, r.top() + (r.height()-h)/2, w, h ), t, #if QT_VERSION >= 300 t->identifier() == keyboardFocusTab() #else t->identitifer() == keyboardFocusTab() #endif ); } void CategoryTabBar::paintLabel( QPainter* p, const QRect&, QTab* t, bool has_focus ) const { QRect r = t->rect(); // if ( t->id != currentTab() ) //r.moveBy( 1, 1 ); diff --git a/core/launcher/launcher.pro b/core/launcher/launcher.pro index f94f338..c77da50 100644 --- a/core/launcher/launcher.pro +++ b/core/launcher/launcher.pro @@ -1,123 +1,123 @@ TEMPLATE = app CONFIG = qt warn_on release DESTDIR = $(OPIEDIR)/bin HEADERS = background.h \ desktop.h \ qprocess.h \ mediummountgui.h \ info.h \ appicons.h \ taskbar.h \ sidething.h \ mrulist.h \ stabmon.h \ inputmethods.h \ systray.h \ wait.h \ shutdownimpl.h \ launcher.h \ launcherview.h \ ../calibrate/calibrate.h \ startmenu.h \ transferserver.h \ qcopbridge.h \ packageslave.h \ irserver.h \ $(OPIEDIR)/rsync/buf.h \ $(OPIEDIR)/rsync/checksum.h \ $(OPIEDIR)/rsync/command.h \ $(OPIEDIR)/rsync/emit.h \ $(OPIEDIR)/rsync/job.h \ $(OPIEDIR)/rsync/netint.h \ $(OPIEDIR)/rsync/protocol.h \ $(OPIEDIR)/rsync/prototab.h \ $(OPIEDIR)/rsync/rsync.h \ $(OPIEDIR)/rsync/search.h \ $(OPIEDIR)/rsync/stream.h \ $(OPIEDIR)/rsync/sumset.h \ $(OPIEDIR)/rsync/trace.h \ $(OPIEDIR)/rsync/types.h \ $(OPIEDIR)/rsync/util.h \ $(OPIEDIR)/rsync/whole.h \ $(OPIEDIR)/rsync/config_rsync.h \ $(OPIEDIR)/rsync/qrsync.h # quicklauncher.h \ SOURCES = background.cpp \ desktop.cpp \ mediummountgui.cpp \ qprocess.cpp qprocess_unix.cpp \ info.cpp \ appicons.cpp \ taskbar.cpp \ sidething.cpp \ mrulist.cpp \ stabmon.cpp \ inputmethods.cpp \ systray.cpp \ wait.cpp \ shutdownimpl.cpp \ launcher.cpp \ launcherview.cpp \ $(OPIEDIR)/calibrate/calibrate.cpp \ transferserver.cpp \ packageslave.cpp \ irserver.cpp \ qcopbridge.cpp \ startmenu.cpp \ main.cpp \ $(OPIEDIR)/rsync/base64.c \ $(OPIEDIR)/rsync/buf.c \ $(OPIEDIR)/rsync/checksum.c \ $(OPIEDIR)/rsync/command.c \ $(OPIEDIR)/rsync/delta.c \ $(OPIEDIR)/rsync/emit.c \ $(OPIEDIR)/rsync/hex.c \ $(OPIEDIR)/rsync/job.c \ $(OPIEDIR)/rsync/mdfour.c \ $(OPIEDIR)/rsync/mksum.c \ $(OPIEDIR)/rsync/msg.c \ $(OPIEDIR)/rsync/netint.c \ $(OPIEDIR)/rsync/patch.c \ $(OPIEDIR)/rsync/prototab.c \ $(OPIEDIR)/rsync/readsums.c \ $(OPIEDIR)/rsync/scoop.c \ $(OPIEDIR)/rsync/search.c \ $(OPIEDIR)/rsync/stats.c \ $(OPIEDIR)/rsync/stream.c \ $(OPIEDIR)/rsync/sumset.c \ $(OPIEDIR)/rsync/trace.c \ $(OPIEDIR)/rsync/tube.c \ $(OPIEDIR)/rsync/util.c \ $(OPIEDIR)/rsync/version.c \ $(OPIEDIR)/rsync/whole.c \ $(OPIEDIR)/rsync/qrsync.cpp INTERFACES = shutdown.ui syncdialog.ui INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include . INCLUDEPATH += $(OPIEDIR)/calibrate DEPENDPATH += $(OPIEDIR)/calibrate INCLUDEPATH += $(OPIEDIR)/rsync DEPENDPATH += $(OPIEDIR)/rsync TARGET = qpe -LIBS += -lqpe -lcrypt -lopie +LIBS += -lqpe -lcrypt TRANSLATIONS = ../i18n/de/qpe.ts TRANSLATIONS += ../i18n/pt_BR/qpe.ts TRANSLATIONS += ../i18n/en/qpe.ts TRANSLATIONS += ../i18n/hu/qpe.ts TRANSLATIONS += ../i18n/ja/qpe.ts TRANSLATIONS += ../i18n/fr/qpe.ts TRANSLATIONS += ../i18n/ko/qpe.ts TRANSLATIONS += ../i18n/no/qpe.ts TRANSLATIONS += ../i18n/zh_CN/qpe.ts TRANSLATIONS += ../i18n/zh_TW/qpe.ts |