[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdegraphics/gwenview
From:       Aurélien Gâteau <agateau () kde ! org>
Date:       2010-05-29 17:27:05
Message-ID: 20100529172705.44FF4AC8C7 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1132091 by gateau:

Make sure all views are aware of document changes

 M  +12 -0     app/documentinfoprovider.cpp  
 M  +1 -0      app/documentinfoprovider.h  
 M  +0 -12     app/thumbnailviewpanel.cpp  
 M  +0 -1      app/thumbnailviewpanel.h  
 M  +1 -0      lib/thumbnailview/abstractdocumentinfoprovider.h  
 M  +3 -1      lib/thumbnailview/thumbnailview.cpp  
 M  +5 -5      lib/thumbnailview/thumbnailview.h  


--- trunk/KDE/kdegraphics/gwenview/app/documentinfoprovider.cpp #1132090:1132091
@@ -43,6 +43,9 @@
 	d->mDirModel = model;
 	connect(DocumentFactory::instance(), SIGNAL(documentBusyStateChanged(const KUrl&, bool)),
 		SLOT(emitBusyStateChanged(const KUrl&, bool)) );
+
+	connect(DocumentFactory::instance(), SIGNAL(documentChanged(const KUrl&)),
+		SLOT(emitDocumentChanged(const KUrl&)) );
 }
 
 
@@ -110,4 +113,13 @@
 }
 
 
+void DocumentInfoProvider::emitDocumentChanged(const KUrl& url) {
+	QModelIndex index = d->mDirModel->indexForUrl(url);
+	if (!index.isValid()) {
+		return;
+	}
+	documentChanged(index);
+}
+
+
 } // namespace
--- trunk/KDE/kdegraphics/gwenview/app/documentinfoprovider.h #1132090:1132091
@@ -47,6 +47,7 @@
 
 private Q_SLOTS:
 	void emitBusyStateChanged(const KUrl&, bool);
+	void emitDocumentChanged(const KUrl&);
 
 private:
 	DocumentInfoProviderPrivate* const d;
--- trunk/KDE/kdegraphics/gwenview/app/thumbnailviewpanel.cpp #1132090:1132091
@@ -201,9 +201,6 @@
 	loadConfig();
 	updateSortOrder();
 	updateThumbnailDetails();
-
-	connect(DocumentFactory::instance(), SIGNAL(documentChanged(const KUrl&)),
-		SLOT(generateThumbnailForUrl(const KUrl&)) );
 }
 
 
@@ -338,13 +335,4 @@
 }
 
 
-void ThumbnailViewPanel::generateThumbnailForUrl(const KUrl& url) {
-	QModelIndex index = d->mDirModel->indexForUrl(url);
-	if (!index.isValid()) {
-		return;
-	}
-	d->mThumbnailView->generateThumbnailForIndex(index);
-}
-
-
 } // namespace
--- trunk/KDE/kdegraphics/gwenview/app/thumbnailviewpanel.h #1132090:1132091
@@ -70,7 +70,6 @@
 	void updateThumbnailDetails();
 	void slotUrlsDropped(const KUrl& destUrl, QDropEvent*);
 	void showMenuForDroppedUrls(const KUrl::List&, const KUrl& destUrl);
-	void generateThumbnailForUrl(const KUrl&);
 
 private:
 	ThumbnailViewPanelPrivate* const d;
--- trunk/KDE/kdegraphics/gwenview/lib/thumbnailview/abstractdocumentinfoprovider.h #1132090:1132091
@@ -57,6 +57,7 @@
 
 Q_SIGNALS:
 	void busyStateChanged(const QModelIndex&, bool);
+	void documentChanged(const QModelIndex&);
 };
 
 
--- trunk/KDE/kdegraphics/gwenview/lib/thumbnailview/thumbnailview.cpp #1132090:1132091
@@ -407,6 +407,8 @@
 	if (provider) {
 		connect(provider, SIGNAL(busyStateChanged(const QModelIndex&, bool)),
 			SLOT(updateThumbnailBusyState(const QModelIndex&, bool)));
+		connect(provider, SIGNAL(documentChanged(const QModelIndex&, bool)),
+			SLOT(updateThumbnail(const QModelIndex&, bool)));
 	}
 }
 
@@ -771,7 +773,7 @@
 }
 
 
-void ThumbnailView::generateThumbnailForIndex(const QModelIndex& index) {
+void ThumbnailView::updateThumbnail(const QModelIndex& index) {
 	KFileItem item = fileItemForIndex(index);
 	KUrl url = item.url();
 	if (d->mDocumentInfoProvider && d->mDocumentInfoProvider->isModified(url)) {
--- trunk/KDE/kdegraphics/gwenview/lib/thumbnailview/thumbnailview.h #1132090:1132091
@@ -73,11 +73,6 @@
 	 */
 	bool isBusy(const QModelIndex& index) const;
 
-	/**
-	 * Generate thumbnail for @a index.
-	 */
-	void generateThumbnailForIndex(const QModelIndex& index);
-
 	virtual void setModel(QAbstractItemModel* model);
 
 	/**
@@ -156,6 +151,11 @@
 	void setBrokenThumbnail(const KFileItem&);
 
 	/**
+	 * Generate thumbnail for @a index.
+	 */
+	void updateThumbnail(const QModelIndex& index);
+
+	/**
 	 * Tells the view the busy state of the document pointed by the index has changed.
 	 */
 	void updateThumbnailBusyState(const QModelIndex& index, bool);
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic