Bug 129450 - cannot exit preview mode within empty album
Summary: cannot exit preview mode within empty album
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Unclassified
Component: Preview-Image (show other bugs)
Version: 0.9.0
Platform: Ubuntu Packages Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-19 21:17 UTC by Marcus Popp
Modified: 2017-07-15 14:55 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 0.9.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marcus Popp 2006-06-19 21:17:32 UTC
Version:           0.9.0-svn (using KDE KDE 3.5.3)
Installed from:    Ubuntu Packages

first of all thank you for this great feature! I really love it.

There is just on minor bug: I cannot exit the preview mode if I am in an empty album.
"Back to album" and "Esc" doesn't work.

Thats it I'm going to use the svn for production. Thank you.
Comment 1 caulier.gilles 2006-06-20 08:38:21 UTC
SVN commit 553136 by cgilles:

digikam from trunk : fix image preview mode rules with empty album
CCBUGS: 129450

 M  +1 -1      albumwidgetstack.h  
 M  +13 -6     digikamview.cpp  
 M  +0 -5      imagepreviewwidget.cpp  
 M  +1 -1      imagepreviewwidget.h  


--- trunk/extragear/graphics/digikam/digikam/albumwidgetstack.h #553135:553136
@@ -58,7 +58,7 @@
     AlbumIconView* albumIconView();
     ImagePreviewWidget* imagePreviewWidget();
 
-    void setPreviewItem(const QString& path);
+    void setPreviewItem(const QString& path=QString::null);
     int  previewMode(void);
     void setPreviewMode(int mode);
 
--- trunk/extragear/graphics/digikam/digikam/digikamview.cpp #553135:553136
@@ -130,7 +130,7 @@
     d->iconView = d->albumPreviews->albumIconView();
 
     d->rightSideBar = new ImagePropertiesSideBarDB(this, "Digikam Right Sidebar", d->splitter, 
-                                                    Sidebar::Right, true, true);
+                                                   Sidebar::Right, true, true);
 
     // To the left.
     d->folderView       = new AlbumFolderView(this);
@@ -323,7 +323,7 @@
 void DigikamView::slotAllAlbumsLoaded()
 {
     disconnect(d->albumManager, SIGNAL(signalAllAlbumsLoaded()),
-                  this, SLOT(slotAllAlbumsLoaded()));
+               this, SLOT(slotAllAlbumsLoaded()));
 
     loadViewState();
     Album *album = d->albumManager->findAlbum(d->initialAlbumID);
@@ -576,14 +576,17 @@
             selected = true;
             AlbumIconItem *firstSelectedItem = d->iconView->firstSelectedItem();
             d->rightSideBar->itemChanged(firstSelectedItem->imageInfo()->kurl(),
-                                       d->iconView, firstSelectedItem, 0, 0);
+                                         d->iconView, firstSelectedItem, 0, 0);
             d->albumPreviews->setPreviewItem(firstSelectedItem->imageInfo()->kurl().path());
             break;
         }
     }
 
     if (!selected)
+    {
+        d->albumPreviews->setPreviewItem();
         emit signal_noCurrentItem();
+    }
 
     emit signal_imageSelected(selected);
 }
@@ -764,19 +767,23 @@
 {
     if (d->albumPreviews->previewMode() == AlbumWidgetStack::PreviewAlbumMode)
     {
-        AlbumIconItem *item;
+        d->albumPreviews->setPreviewMode( AlbumWidgetStack::PreviewItemMode );
+        AlbumIconItem *item=0;
 
         if (!iconItem)
         {
             item = d->iconView->firstSelectedItem();
-            if (!item) return;
+            if (!item) 
+            {
+                d->albumPreviews->setPreviewItem();
+                return;
+            }
         }
         else
         {
             item = iconItem;
         }
 
-        d->albumPreviews->setPreviewMode( AlbumWidgetStack::PreviewItemMode );
         d->albumPreviews->setPreviewItem( item->imageInfo()->kurl().path() );
     }
     else
--- trunk/extragear/graphics/digikam/digikam/imagepreviewwidget.cpp #553135:553136
@@ -33,8 +33,6 @@
 #include <kprocess.h>
 #include <kdebug.h>
 #include <klocale.h>
-#include <kapplication.h>
-#include <kfilemetainfo.h>
 
 // Local includes.
 
@@ -105,7 +103,6 @@
 {
     if (path == d->path) return;
 
-    kapp->setOverrideCursor( KCursor::waitCursor() );
     d->path              = path;
     d->previewBlink      = false;
     d->blinkPreviewTimer->start(200);
@@ -137,7 +134,6 @@
     d->pixmap     = QPixmap(contentsRect().size());
     updatePixmap();
     repaint(false);
-    kapp->restoreOverrideCursor();
     emit previewUnderProgress(false);
 }
 
@@ -149,7 +145,6 @@
     d->pixmap     = QPixmap(contentsRect().size());
     updatePixmap();
     repaint(false);
-    kapp->restoreOverrideCursor();
     emit previewUnderProgress(false);
 }
 
--- trunk/extragear/graphics/digikam/digikam/imagepreviewwidget.h #553135:553136
@@ -48,7 +48,7 @@
     ImagePreviewWidget(QWidget *parent=0);
     ~ImagePreviewWidget();
 
-    void setImagePath(const QString& path);
+    void setImagePath(const QString& path=QString::null);
 
 signals:
 
Comment 2 caulier.gilles 2006-06-20 12:00:24 UTC
SVN commit 553174 by cgilles:

digikam from trunk : fix image preview mode rules with empty album (2)
CCBUGS: 129450

 M  +23 -5     albumwidgetstack.cpp  
 M  +3 -1      albumwidgetstack.h  
 M  +3 -3      imagepreviewwidget.cpp  
 M  +4 -1      imagepreviewwidget.h  


--- trunk/extragear/graphics/digikam/digikam/albumwidgetstack.cpp #553173:553174
@@ -104,8 +104,14 @@
     connect(ThemeEngine::instance(), SIGNAL(signalThemeChanged()),
             this, SLOT(slotThemeChanged()));                
 
-    connect(d->previewItemWidget, SIGNAL( previewUnderProgress(bool) ),
-            this, SLOT( slotToogleButtons(bool) ) );          
+    connect(d->previewItemWidget, SIGNAL( previewStarted() ),
+            this, SLOT( slotPreviewStarted() ) );          
+    
+    connect(d->previewItemWidget, SIGNAL( previewComplete() ),
+            this, SLOT( slotPreviewComplete() ) );          
+    
+    connect(d->previewItemWidget, SIGNAL( previewFailed() ),
+            this, SLOT( slotPreviewFailed() ) );          
 }
 
 AlbumWidgetStack::~AlbumWidgetStack()
@@ -148,12 +154,24 @@
     visibleWidget()->setFocus();
 }
 
-void AlbumWidgetStack::slotToogleButtons(bool t)
+void AlbumWidgetStack::slotPreviewStarted()
 {
-    d->backButton->setEnabled(!t);
-    d->editButton->setEnabled(!t);
+    d->backButton->setEnabled(false);
+    d->editButton->setEnabled(false);
 }
 
+void AlbumWidgetStack::slotPreviewComplete()
+{
+    d->backButton->setEnabled(true);
+    d->editButton->setEnabled(true);
+}
+
+void AlbumWidgetStack::slotPreviewFailed()
+{
+    d->backButton->setEnabled(true);
+    d->editButton->setEnabled(false);
+}
+
 }  // namespace Digikam
 
 #include "albumwidgetstack.moc"
--- trunk/extragear/graphics/digikam/digikam/albumwidgetstack.h #553173:553174
@@ -70,7 +70,9 @@
 private slots:
     
     void slotThemeChanged();
-    void slotToogleButtons(bool);
+    void slotPreviewStarted();
+    void slotPreviewComplete();
+    void slotPreviewFailed();
 
 private:
 
--- trunk/extragear/graphics/digikam/digikam/imagepreviewwidget.cpp #553173:553174
@@ -115,7 +115,7 @@
     connect(d->previewJob, SIGNAL(signalFailed(const KURL&)),
             this, SLOT(slotFailedImagePreview(const KURL&)));   
 
-    emit previewUnderProgress(true);
+    emit previewStarted();
 }
 
 void ImagePreviewWidget::slotPreviewBlinkTimerDone()
@@ -134,7 +134,7 @@
     d->pixmap     = QPixmap(contentsRect().size());
     updatePixmap();
     repaint(false);
-    emit previewUnderProgress(false);
+    emit previewComplete();
 }
 
 void ImagePreviewWidget::slotFailedImagePreview(const KURL&)
@@ -145,7 +145,7 @@
     d->pixmap     = QPixmap(contentsRect().size());
     updatePixmap();
     repaint(false);
-    emit previewUnderProgress(false);
+    emit previewFailed();
 }
 
 void ImagePreviewWidget::updatePixmap( void )
--- trunk/extragear/graphics/digikam/digikam/imagepreviewwidget.h #553173:553174
@@ -57,7 +57,10 @@
     void lastItem();
     void firstItem();
     void escapeSignal();
-    void previewUnderProgress(bool);
+    
+    void previewStarted();
+    void previewComplete();
+    void previewFailed();
 
 public slots:
 
Comment 3 caulier.gilles 2006-06-20 12:15:23 UTC
SVN commit 553177 by cgilles:

digikam from trunk : fix image preview mode rules with empty album (3)
BUG: 129450

 M  +9 -0      albumwidgetstack.cpp  
 M  +3 -3      digikamview.cpp  


--- trunk/extragear/graphics/digikam/digikam/albumwidgetstack.cpp #553176:553177
@@ -136,8 +136,17 @@
 
 void AlbumWidgetStack::setPreviewItem(const QString& path)
 {
+    if (path.isNull())
+    {
+        d->previewItemWidget->setImagePath();
+        slotPreviewFailed();
+    }
+    
     if (previewMode() == PreviewItemMode)
+    {
+        visibleWidget()->setFocus();
         d->previewItemWidget->setImagePath(path);
+    }
 }
 
 int AlbumWidgetStack::previewMode(void)
--- trunk/extragear/graphics/digikam/digikam/digikamview.cpp #553176:553177
@@ -754,6 +754,8 @@
     AlbumIconItem *currItem = dynamic_cast<AlbumIconItem*>(d->iconView->currentItem());
     if (currItem)
         slot_imagePreview(currItem);
+    else
+        slot_imagePreview(0);
 }
 
 void DigikamView::slotEditImage()
@@ -767,6 +769,7 @@
 {
     if (d->albumPreviews->previewMode() == AlbumWidgetStack::PreviewAlbumMode)
     {
+        d->albumPreviews->setPreviewItem();
         d->albumPreviews->setPreviewMode( AlbumWidgetStack::PreviewItemMode );
         AlbumIconItem *item=0;
 
@@ -774,10 +777,7 @@
         {
             item = d->iconView->firstSelectedItem();
             if (!item) 
-            {
-                d->albumPreviews->setPreviewItem();
                 return;
-            }
         }
         else
         {
Comment 4 caulier.gilles 2006-06-20 18:01:35 UTC
SVN commit 553282 by cgilles:

digikam from trunk : fix image preview mode rules with empty album (4)
CCBUGS: 129450

 M  +2 -8      albumwidgetstack.cpp  
 M  +3 -1      digikamview.cpp  


--- trunk/extragear/graphics/digikam/digikam/albumwidgetstack.cpp #553281:553282
@@ -137,16 +137,10 @@
 void AlbumWidgetStack::setPreviewItem(const QString& path)
 {
     if (path.isNull())
-    {
-        d->previewItemWidget->setImagePath();
         slotPreviewFailed();
-    }
     
-    if (previewMode() == PreviewItemMode)
-    {
-        visibleWidget()->setFocus();
-        d->previewItemWidget->setImagePath(path);
-    }
+    visibleWidget()->setFocus();
+    d->previewItemWidget->setImagePath(path);
 }
 
 int AlbumWidgetStack::previewMode(void)
--- trunk/extragear/graphics/digikam/digikam/digikamview.cpp #553281:553282
@@ -769,7 +769,6 @@
 {
     if (d->albumPreviews->previewMode() == AlbumWidgetStack::PreviewAlbumMode)
     {
-        d->albumPreviews->setPreviewItem();
         d->albumPreviews->setPreviewMode( AlbumWidgetStack::PreviewItemMode );
         AlbumIconItem *item=0;
 
@@ -777,7 +776,10 @@
         {
             item = d->iconView->firstSelectedItem();
             if (!item) 
+            {
+                d->albumPreviews->setPreviewItem();
                 return;
+            }
         }
         else
         {