summaryrefslogtreecommitdiff
path: root/core
authorkergoth <kergoth>2003-08-09 17:38:23 (UTC)
committer kergoth <kergoth>2003-08-09 17:38:23 (UTC)
commitec14206f63dd93e9fb84c76cbc76fc1968637590 (patch) (side-by-side diff)
treea42b2a348677476b622c01aeef631b446eb4b0b7 /core
parenta0bab0e281fbaf6f6ebbb1a48e5c06426bfbbb93 (diff)
downloadopie-ec14206f63dd93e9fb84c76cbc76fc1968637590.zip
opie-ec14206f63dd93e9fb84c76cbc76fc1968637590.tar.gz
opie-ec14206f63dd93e9fb84c76cbc76fc1968637590.tar.bz2
Merge from BRANCH_1_0
Diffstat (limited to 'core') (more/less context) (show whitespace changes)
-rw-r--r--core/launcher/launcher.cpp158
1 files changed, 97 insertions, 61 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp
index 8b2907a..0205622 100644
--- a/core/launcher/launcher.cpp
+++ b/core/launcher/launcher.cpp
@@ -19,12 +19,14 @@
**********************************************************************/
// WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT
// have this class.
#define QTOPIA_INTERNAL_FSLP
+//#include <opie/ofiledialog.h>
+#include <opie/ofileselector.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>
@@ -160,47 +162,47 @@ void CategoryTabWidget::showTab(const QString& id)
categoryBar->setCurrentTab( idx );
}
}
void CategoryTabWidget::addItem( const QString& linkfile )
{
- int i=0;
- AppLnk *app = new AppLnk(linkfile);
- if ( !app->isValid() ) {
- delete app;
- app=0;
- }
- if ( !app || !app->file().isEmpty() ) {
+// int i=0;
+// AppLnk *app = new AppLnk(linkfile);
+// if ( !app->isValid() ) {
+// delete app;
+// app=0;
+// }
+// if ( !app || !app->file().isEmpty() ) {
// A document
- delete app;
- app = new DocLnk(linkfile);
- if ( app->fileKnown() ) {
- ((LauncherView*)(stack->widget(ids.count()-1)))->addItem(app);
- } else {
- ((LauncherView*)(stack->widget(ids.count()-1)))->sort();
- delete app;
- }
- return;
- }
+// delete app;
+// app = new DocLnk(linkfile);
+// if ( app->fileKnown() ) {
+// ((LauncherView*)(stack->widget(ids.count()-1)))->addItem(app);
+// } else {
+// ((LauncherView*)(stack->widget(ids.count()-1)))->sort();
+// delete app;
+// }
+// return;
+// }
// An application
- 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++;
- }
- }
+// 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++;
+ // }
+ // }
QCopEnvelope e("QPE/TaskBar","reloadApps()");
}
void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder,
- AppLnkSet* docFolder, const QList<FileSystem> &fs)
+ AppLnkSet* /*docFolder*/, const QList<FileSystem> & /*fs*/)
{
QString current;
if ( categoryBar ) {
int c = categoryBar->currentTab();
if ( c >= 0 ) current = ids[c];
}
@@ -248,19 +250,29 @@ void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder,
((LauncherView*)stack->widget(i))->sort();
// all documents
QImage img( Resource::loadImage( "DocsIcon" ) );
QPixmap pm;
pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() );
- docview = newView( "Documents", // No tr
- pm, tr("Documents"));
- docview->populate( docFolder, QString::null );
- docFolder->detachChildren();
- docview->setFileSystems(fs);
- docview->setToolsEnabled(TRUE);
- setTabAppearance( "Documents", cfg ); // No tr
+
+ //ljpotter
+ CategoryTab *catTab ;
+ catTab = new CategoryTab( pm, "Documents" );
+
+ categoryBar->addTab( catTab );
+
+ fileSel = new DocumentTab( stack, 4, 0, "/","");
+ stack->addWidget( fileSel, tabs++ );
+
+ // fileSel->hide();
+
+ connect( fileSel, SIGNAL( fileSelected( const DocLnk & )),
+ this, SLOT(clickie(const DocLnk&)) );
+
+// connect( fileSel, SIGNAL( fileSelected( const QString & )),
+// this, SLOT(clickie(const QString&)) );
connect( categoryBar, SIGNAL(selected(int)), stack, SLOT(raiseWidget(int)) );
((LauncherView*)stack->widget(0))->setFocus();
cfg. setGroup ( "GUI" );
@@ -270,15 +282,26 @@ void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder,
showTab(current);
}
categoryBar->show();
stack->show();
+
QCopEnvelope e("QPE/TaskBar","reloadApps()");
}
+void CategoryTabWidget::clickie(const DocLnk &lnk) {
+ lnk.execute();
+ // fileSel->reparse();
+}
+
+void CategoryTabWidget::clickie(const QString &appStr) {
+// DocLnk lnk(appStr);
+// lnk.execute();
+}
+
void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg )
{
QString grp( "Tab %1" ); // No tr
cfg.setGroup( grp.arg(id) );
LauncherView *v = view( id );
int idx = ids.findIndex( id );
@@ -315,19 +338,16 @@ void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg )
if ( tabTextCol.isEmpty() )
tab->fgColor = QColor();
else
tab->fgColor = QColor(tabTextCol);
}
-void CategoryTabWidget::updateDocs(AppLnkSet* docFolder, const QList<FileSystem> &fs)
-{
- docview->populate( docFolder, QString::null );
- docFolder->detachChildren();
- docview->setFileSystems(fs);
- docview->updateTools();
-}
+//void CategoryTabWidget::updateDocs(AppLnkSet* docFolder, const QList<FileSystem> & /*fs*/)
+//{
+ // docFolder->detachChildren();
+//}
void CategoryTabWidget::tabProperties()
{
LauncherView *view = (LauncherView*)stack->widget( categoryBar->currentTab() );
QPopupMenu *m = new QPopupMenu( this );
m->insertItem( tr("Icon View"), LauncherView::Icon );
@@ -340,13 +360,13 @@ void CategoryTabWidget::tabProperties()
delete m;
}
QString CategoryTabWidget::getAllDocLinkInfo() const
{
- return docview->getAllDocLinkInfo();
+ return "";
}
LauncherView* CategoryTabWidget::newView( const QString& id, const QPixmap& pm, const QString& label )
{
LauncherView* view = new LauncherView( stack );
connect( view, SIGNAL(clicked(const AppLnk*)),
@@ -358,21 +378,20 @@ LauncherView* CategoryTabWidget::newView( const QString& id, const QPixmap& pm,
stack->addWidget( view, tabs++ );
return view;
}
void CategoryTabWidget::updateLink(const QString& linkfile)
{
- int i=0;
- LauncherView* view;
- //qApp->processEvents();
- while ((view = (LauncherView*)stack->widget(i++))) {
- if ( view->removeLink(linkfile) )
- break;
- }
- addItem(linkfile);
- docview->updateTools();
+ // LauncherView* view;
+ qApp->processEvents();
+// while ((view = (LauncherView*)stack->widget(i++))) {
+// if ( view->removeLink(linkfile) )
+// break;
+// }
+ // addItem(linkfile);
+ fileSel->reparse();
}
void CategoryTabWidget::paletteChange( const QPalette &p )
{
QVBox::paletteChange( p );
QPalette pal = palette();
@@ -384,13 +403,13 @@ void CategoryTabWidget::paletteChange( const QPalette &p )
void CategoryTabWidget::setBusy(bool on)
{
if ( on )
((LauncherView*)stack->visibleWidget())->setBusy(TRUE);
else
- for (int i=0; i<tabs; i++)
+ for (int i=0; i<tabs-1; i++)
((LauncherView*)stack->widget(i))->setBusy(FALSE);
}
LauncherView *CategoryTabWidget::view( const QString &id )
{
int idx = ids.findIndex( id );
@@ -645,12 +664,13 @@ Launcher::Launcher( QWidget* parent, const char* name, WFlags fl )
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(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 &)) );
QCopChannel *channel = new QCopChannel( "QPE/Launcher", this );
connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
@@ -729,22 +749,19 @@ void Launcher::updateMimeTypes(AppLnkSet* folder)
* c) the user enabled medium checking on a per medium bases
* c1) we already checked and its not ask again turns
* c2) we need to ask and then apply the mimefilter
*/
void Launcher::loadDocs() // ok here comes a hack belonging to Global::
{
-
OWait *owait = new OWait();
Global::statusMessage( tr( "Finding documents" ) );
owait->show();
qApp->processEvents();
-
- delete docsFolder;
+ if(docsFolder) delete docsFolder;
docsFolder = new DocLnkSet;
-
DocLnkSet *tmp = 0;
QString home = QString(getenv("HOME")) + "/Documents";
tmp = new DocLnkSet( home , QString::null);
docsFolder->appendFrom( *tmp );
delete tmp;
@@ -761,15 +778,17 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global::
}
}
Config mediumCfg( "medium");
mediumCfg.setGroup("main");
// a) -zecke we don't want to check
- if(!mediumCfg.readBoolEntry("use", true ) )
+ if(!mediumCfg.readBoolEntry("use", true ) ) {
+ owait->hide();
+ delete owait;
return;
-
+ }
// find out wich filesystems are new in this round
// We will do this by having a timestamp inside each mountpoint
// if the current timestamp doesn't match this is a new file system and
// come up with our MediumMountGui :) let the hacking begin
int stamp = uidgen.generate();
@@ -782,12 +801,14 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global::
if( (*it)->isRemovable() ){
tmp = new DocLnkSet( (*it)->path(), mime );
docsFolder->appendFrom( *tmp );
delete tmp;
}
} // done
+ owait->hide();
+ delete owait;
return; // save the else
}
// c) zecke
for ( it.toFirst(); it.current(); ++it ) {
if ( (*it)->isRemovable() ) { // let's find out if we should search on it
Config cfg( (*it)->path() + "/.opiestorage.cf", Config::File);
@@ -845,25 +866,24 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global::
delete owait;
}
void Launcher::updateTabs()
{
MimeType::updateApplications(); // ### reads all applnks twice
-
delete rootFolder;
rootFolder = new AppLnkSet( MimeType::appsFolderName() );
loadDocs();
tabs->initializeCategories(rootFolder, docsFolder, storage->fileSystems());
}
void Launcher::updateDocs()
{
loadDocs();
- tabs->updateDocs(docsFolder,storage->fileSystems());
+ // tabs->updateDocs(docsFolder,storage->fileSystems());
}
void Launcher::viewSelected(const QString& s)
{
setCaption( s + tr(" - Launcher") );
}
@@ -1314,6 +1334,22 @@ void Launcher::preloadApps()
for (QStringList::ConstIterator it=apps.begin(); it!=apps.end(); ++it) {
#ifndef QT_NO_COP
QCopEnvelope e("QPE/Application/"+(*it).local8Bit(), "enablePreload()");
#endif
}
}
+
+DocumentTab::DocumentTab( QWidget *parent, int mode, int selector, const QString &dirName, const QString &fileName)
+ : OFileSelector(parent,mode,selector,dirName,fileName)
+{
+ setYesCancelVisible(false);
+ setToolbarVisible(false);
+ setPermissionBarVisible(false);
+ setLineEditVisible(false) ;
+ //setChooserVisible( bool chooser );
+
+}
+
+DocumentTab::~DocumentTab() {
+
+}
+