summaryrefslogtreecommitdiff
path: root/core/launcher
authoralwin <alwin>2004-11-09 20:19:53 (UTC)
committer alwin <alwin>2004-11-09 20:19:53 (UTC)
commitc7b97ac140de31282dba2463a00f434c7a5bba69 (patch) (side-by-side diff)
tree3be0a497f30d2265359e99dbc0951ab0b594e865 /core/launcher
parent439b89dbda8afb2deeb0461dcd249a3e80131825 (diff)
downloadopie-c7b97ac140de31282dba2463a00f434c7a5bba69.zip
opie-c7b97ac140de31282dba2463a00f434c7a5bba69.tar.gz
opie-c7b97ac140de31282dba2463a00f434c7a5bba69.tar.bz2
- removed code which let qpe crash when generating image icons
- when edit properties of an document item it will reread the table of categories
Diffstat (limited to 'core/launcher') (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcher.cpp18
-rw-r--r--core/launcher/launcherview.cpp127
-rw-r--r--core/launcher/launcherview.h1
3 files changed, 70 insertions, 76 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp
index 010a2e9..5ec1cf8 100644
--- a/core/launcher/launcher.cpp
+++ b/core/launcher/launcher.cpp
@@ -354,18 +354,18 @@ void LauncherTabWidget::setProgressStyle()
void LauncherTabWidget::setBusy(bool on)
{
if ( on )
currentView()->setBusy(TRUE);
else {
for ( int i = 0; i < categoryBar->count(); i++ ) {
- if (categoryBar->tab(i)) {
- LauncherView *view = ((LauncherTab *)categoryBar->tab(i))->view;
- view->setBusy( FALSE );
- } else {
- odebug << "Averting Disaster with tab " << i << " == NULL! " << oendl;
- }
+ if (categoryBar->tab(i)) {
+ LauncherView *view = ((LauncherTab *)categoryBar->tab(i))->view;
+ view->setBusy( FALSE );
+ } else {
+ odebug << "Averting Disaster with tab " << i << " == NULL! " << oendl;
+ }
}
}
}
void LauncherTabWidget::setBusyIndicatorType( const QString& str ) {
for (int i = 0; i < categoryBar->count(); i++ ) {
@@ -598,15 +598,17 @@ void Launcher::select( const AppLnk *appLnk )
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 );
+ LnkProperties prop(appLnk,0 );
- QPEApplication::execDialog( &prop );
+ 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
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp
index 72313e3..ff26133 100644
--- a/core/launcher/launcherview.cpp
+++ b/core/launcher/launcherview.cpp
@@ -128,13 +128,13 @@ LauncherItem::LauncherItem( QIconView *parent, AppLnk *applnk, bool bigIcon )
}
LauncherItem::~LauncherItem()
{
LauncherIconView* liv = (LauncherIconView*)iconView();
if ( liv->busyItem() == this )
- liv->setBusy(FALSE);
+ liv->setBusy(FALSE);
delete app;
}
QPixmap*LauncherItem::pixmap()const
{
if (m_EyeImage && m_EyeImageSet == BASE_ICON) {
@@ -273,12 +273,13 @@ LauncherIconView::LauncherIconView( QWidget* parent, const char* name )
calculateGrid( Bottom );
connect(&m_eyeTimer,SIGNAL(timeout()),this,SLOT(stopEyeTimer()));
}
LauncherIconView::~LauncherIconView()
{
+ odebug << "LauncherIconView::~LauncherIconView()" << oendl;
#if 0 // debuggery
QListIterator<AppLnk> it(hidden);
AppLnk* l;
while ((l=it.current())) {
++it;
//odebug << "" << l << ": hidden (should remove)" << oendl;
@@ -426,20 +427,13 @@ LauncherItem*LauncherIconView::findDocItem(const QString&fname)
}
void LauncherIconView::setEyePixmap(const QPixmap&aPixmap,const QString&aFile,int width)
{
int s = ( bigIcns ) ? AppLnk::bigIconSize() : AppLnk::smallIconSize();
if (s!=width) return;
- LauncherItem*item = 0;
- QMap<QString,LauncherItem*>::Iterator it;
- if ( ( it = m_itemCache.find(aFile))!=m_itemCache.end()) {
- item = it.data();
- m_itemCache.remove(it);
- } else {
- item = findDocItem(aFile);
- }
+ LauncherItem*item = findDocItem(aFile);
if (!item||!item->isEyeImage()) return;
item->setEyePixmap(aPixmap);
}
void LauncherIconView::checkCallback()
{
@@ -462,24 +456,22 @@ void LauncherIconView::addCheckItem(AppLnk* app)
void LauncherIconView::requestEyePix(const LauncherItem*item)
{
if (!item) return;
if (item->isEyeImage()) {
checkCallback();
int s = ( bigIcns ) ? AppLnk::bigIconSize() : AppLnk::smallIconSize();
- m_itemCache[item->appLnk()->file()]=(LauncherItem*)item;
m_EyeCallBack->requestThumb(item->appLnk()->file(),s,s);
}
}
void LauncherIconView::stopEyeTimer()
{
if (m_EyeCallBack) {
delete m_EyeCallBack;
m_EyeCallBack=0;
}
- m_itemCache.clear();
m_eyeTimer.stop();
}
void LauncherIconView::addItem(AppLnk* app, bool resort)
{
addCatsAndMimes(app);
@@ -699,89 +691,88 @@ void LauncherView::hideIcons()
icons->hide();
}
void LauncherView::setToolsEnabled(bool y)
{
if ( !y != !tools ) {
- if ( y ) {
- tools = new QHBox(this);
-
- // Type filter
- typemb = new QComboBox(tools);
- QSizePolicy p = typemb->sizePolicy();
- p.setHorData(QSizePolicy::Expanding);
- typemb->setSizePolicy(p);
-
- // Category filter
- updateTools();
- tools->show();
-
- } else {
- delete tools;
- tools = 0;
- }
+ if ( y ) {
+ tools = new QHBox(this);
+ // Type filter
+ typemb = new QComboBox(tools);
+ QSizePolicy p = typemb->sizePolicy();
+ p.setHorData(QSizePolicy::Expanding);
+ typemb->setSizePolicy(p);
+ // Category filter
+ updateTools();
+ tools->show();
+ } else {
+ delete tools;
+ tools = 0;
+ }
}
}
void LauncherView::updateTools()
{
disconnect( typemb, SIGNAL(activated(int)),
this, SLOT(showType(int)) );
- if ( catmb ) disconnect( catmb, SIGNAL(signalSelected(int)),
- this, SLOT(showCategory(int)) );
+ if ( catmb ) {
+ disconnect( catmb, SIGNAL(signalSelected(int)),this,SLOT(showCategory(int)));
+ }
// ### I want to remove this
icons->updateCategoriesAndMimeTypes();
QString prev;
// Type filter
QStringList types;
typelist = icons->mimeTypes();
for (QStringList::ConstIterator it = typelist.begin(); it!=typelist.end(); ++it) {
- QString t = *it;
- if ( t.left(12) == "application/" ) {
- MimeType mt(t);
- const AppLnk* app = mt.application();
- if ( app )
- t = app->name();
- else
- t = t.mid(12);
- } else {
- t[0] = t[0].upper();
- }
- types += t;
+ QString t = *it;
+ if ( t.left(12) == "application/" ) {
+ MimeType mt(t);
+ const AppLnk* app = mt.application();
+ if ( app )
+ t = app->name();
+ else
+ t = t.mid(12);
+ } else {
+ t[0] = t[0].upper();
+ }
+ types += t;
}
types << tr("All types");
prev = typemb->currentText();
typemb->clear();
typemb->insertStringList(types);
for (int i=0; i<typemb->count(); i++) {
- if ( typemb->text(i) == prev ) {
- typemb->setCurrentItem(i);
- break;
+ if ( typemb->text(i) == prev ) {
+ typemb->setCurrentItem(i);
+ break;
+ }
}
+ if ( prev.isNull() ) {
+ typemb->setCurrentItem(typemb->count()-1);
}
- if ( prev.isNull() )
- typemb->setCurrentItem(typemb->count()-1);
int pcat = catmb ? catmb->currentCategory() : -2;
if ( !catmb )
- catmb = new CategorySelect(tools);
+ catmb = new CategorySelect(tools);
Categories cats( 0 );
cats.load( categoryFileName() );
QArray<int> vl( 0 );
catmb->setCategories( vl, "Document View", // No tr
- tr("Document View") );
+ tr("Document View") );
catmb->setRemoveCategoryEdit( TRUE );
catmb->setAllCategories( TRUE );
catmb->setCurrentCategory(pcat);
// if type has changed we need to redisplay
if ( typemb->currentText() != prev )
- showType( typemb->currentItem() );
+ showType( typemb->currentItem() );
connect(typemb, SIGNAL(activated(int)), this, SLOT(showType(int)));
connect(catmb, SIGNAL(signalSelected(int)), this, SLOT(showCategory(int)));
}
void LauncherView::sortBy(int s)
@@ -789,43 +780,44 @@ void LauncherView::sortBy(int s)
icons->setSortMethod((LauncherIconView::SortMethod)s);
}
void LauncherView::showType(int t)
{
if ( t >= (int)typelist.count() ) {
- icons->setTypeFilter("",TRUE);
+ icons->setTypeFilter("",TRUE);
} else {
- QString ty = typelist[t];
- if ( !ty.contains('/') )
- ty += "/*";
- icons->setTypeFilter(ty,TRUE);
+ QString ty = typelist[t];
+ if ( !ty.contains('/') )
+ ty += "/*";
+ icons->setTypeFilter(ty,TRUE);
}
}
void LauncherView::showCategory( int c )
{
icons->setCategoryFilter( c, TRUE );
}
void LauncherView::setViewMode( ViewMode m )
{
+ odebug << "LauncherView::setViewMode( ViewMode m )" << oendl;
if ( vmode != m ) {
- bool bigIcons = m == Icon;
- icons->viewport()->setUpdatesEnabled( FALSE );
- icons->setBigIcons( bigIcons );
- switch ( m ) {
- case List:
- icons->setItemTextPos( QIconView::Right );
+ bool bigIcons = m == Icon;
+ icons->viewport()->setUpdatesEnabled( FALSE );
+ icons->setBigIcons( bigIcons );
+ switch ( m ) {
+ case List:
+ icons->setItemTextPos( QIconView::Right );
break;
case Icon:
- icons->setItemTextPos( QIconView::Bottom );
+ icons->setItemTextPos( QIconView::Bottom );
break;
- }
- icons->hideOrShowItems( FALSE );
- icons->viewport()->setUpdatesEnabled( TRUE );
- vmode = m;
+ }
+ icons->hideOrShowItems( FALSE );
+ icons->viewport()->setUpdatesEnabled( TRUE );
+ vmode = m;
}
}
//
// User images may require scaling.
//
@@ -1043,12 +1035,13 @@ void LauncherView::itemPressed( int btn, QIconViewItem *item )
item->setSelected(FALSE);
}
}
void LauncherView::removeAllItems()
{
+ odebug << "LauncherView::removeAllItems()" << oendl;
icons->clear();
}
bool LauncherView::removeLink(const QString& linkfile)
{
return icons->removeLink(linkfile);
@@ -1165,13 +1158,13 @@ void LauncherThumbReceiver::requestThumb(const QString&file,int width,int height
{
PixmapInfo rItem;
rItem.file = file;
rItem.width = width;
rItem.height = height;
m_inThumbNail.append(rItem);
- QTimer::singleShot(0, this, SLOT(sendRequest()));
+ QTimer::singleShot(2, this, SLOT(sendRequest()));
}
void LauncherThumbReceiver::sendRequest()
{
if (m_inThumbNail.count()>0) {
QCopEnvelope env("QPE/opie-eye_slave", "pixmapInfos(PixmapInfos)" );
diff --git a/core/launcher/launcherview.h b/core/launcher/launcherview.h
index 94c367c..6d94539 100644
--- a/core/launcher/launcherview.h
+++ b/core/launcher/launcherview.h
@@ -237,10 +237,9 @@ private:
LauncherThumbReceiver*m_EyeCallBack;
#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY
QPixmap busyPix;
#endif
BusyIndicatorType busyType;
QTimer m_eyeTimer;
- QMap<QString,LauncherItem*> m_itemCache;
};
#endif // LAUNCHERVIEW_H