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.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp
index 5ec1cf8..ccc2114 100644
--- a/core/launcher/launcher.cpp
+++ b/core/launcher/launcher.cpp
@@ -56,49 +56,49 @@
#include <qwidgetstack.h>
#include <qregexp.h>
#include <qmessagebox.h>
#include <qframe.h>
#include <qpainter.h>
#include <qlabel.h>
#include <qtextstream.h>
#include <qpopupmenu.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
static bool isVisibleWindow( int );
//===========================================================================
LauncherTabWidget::LauncherTabWidget( Launcher* parent ) :
- QVBox( parent ), docview( 0 )
+ QVBox( parent ), docview( 0 ),docTabEnabled(true),m_DocumentTabId(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();
@@ -107,49 +107,49 @@ LauncherTabWidget::LauncherTabWidget( Launcher* parent ) :
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 );
+ docTabEnabled = cfg.readBoolEntry( "Enable", true );
QLabel *textLabel = new QLabel( docLoadingVBox );
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();
docLoadingWidgetEnabled = true;
}
QWidget *space2 = new QWidget( docLoadingVBox );
docLoadingVBox->setStretchFactor( space2, 1 );
@@ -195,56 +195,59 @@ void LauncherTabWidget::tabProperties()
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" )
+ if ( id == "Documents" ) {
docview = view;
+ m_DocumentTabId = n;
+ }
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;
}
@@ -583,49 +586,48 @@ void Launcher::select( const AppLnk *appLnk )
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);
/* ### Fixme */
if ( i == 1 )
Global::execute("textedit",appLnk->file());
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 );
if (QPEApplication::execDialog( &prop )==QDialog::Accepted && tabs->currentView()==tabs->docView()) {
- tabs->docView()->updateTools();
}
}
}
void Launcher::storageChanged( const QList<FileSystem> & )
{
// ### 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();
}
}
@@ -700,50 +702,55 @@ void Launcher::aboutToAddBegin()
void Launcher::aboutToAddEnd()
{
tabs->docView()->setUpdatesEnabled( true );
}
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 )
{
+#if 0
documentRemoved( oldDoc );
documentAdded( newDoc );
+// tabs->docView()->updateTools();
+#else
+ tabs->docView()->changeItem(oldDoc,new DocLnk(newDoc));
+#endif
}
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) {