summaryrefslogtreecommitdiff
path: root/core/launcher/launcher.cpp
Side-by-side diff
Diffstat (limited to 'core/launcher/launcher.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/launcher/launcher.cpp37
1 files changed, 17 insertions, 20 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp
index 5d0c778..bf2287d 100644
--- a/core/launcher/launcher.cpp
+++ b/core/launcher/launcher.cpp
@@ -1,101 +1,98 @@
/**********************************************************************
** 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 "startmenu.h"
+#include "taskbar.h"
+#include "serverinterface.h"
+#include "launcherview.h"
+#include "launcher.h"
+#include "server.h"
+
+/* OPIE */
+#include <opie2/odebug.h>
#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/qpeapplication.h>
#include <qtopia/mimetype.h>
#include <qtopia/private/categories.h>
-//#include <qtopia/custom.h>
+#define QTOPIA_INTERNAL_FSLP
+#include <qtopia/lnkproperties.h>
+/* QT */
#include <qdir.h>
#ifdef Q_WS_QWS
+#include <qkeyboard_qws.h>
#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 <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>
+/* STD */
#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 ), 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&)),
@@ -207,49 +204,49 @@ void LauncherTabWidget::deleteView( const QString& 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 );
+ odebug << "inserting " << id << " at " << n-1 << "" << oendl;
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 )
@@ -392,49 +389,49 @@ void LauncherTabWidget::launcherMessage( const QCString &msg, const QByteArray &
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 );
+ odebug << "setFont: " << fam << ", " << size << ", " << weight << ", " << italic << "" << oendl;
} 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 )
{
@@ -663,49 +660,49 @@ void Launcher::typeRemoved( const QString& 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() );
+ owarn << "removeAppLnk: No view for " << type << "!" << oendl;
}
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();
}