Open File patch (was Re: some whishlists)

Carles Pina i Estany <[email protected]> Thu, 31 Jan 2008 20:56:20 +0100
Newsgroups gmane.comp.kde.gwenview
Message-ID <[email protected]>
Hello,

On Jan/29/2008, Aurélien Gâteau wrote:

> > patch is now attached.
> > As usually: feel free to change, comment or reject it :-) (I see that F6
> > is editting the location bar, but I still expect a File - Open).
> 
> Thanks for the patch, but I think people would expect file/open to let 
> them select an image rather than a folder. It would be more consistent 
> with other entries in the file menu.

attached. Yes, even I like it better :-)

-- 
Carles Pina i Estany		GPG id: 0x8CBDAE64
	http://pinux.info	Manresa - Barcelona

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________
Gwenview-general mailing list
Gwenview-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/gwenview-general
open_file.patch (text/x-diff, 1.4 KB)
Index: app/mainwindow.h
===================================================================
--- app/mainwindow.h	(revision 769171)
+++ app/mainwindow.h	(working copy)
@@ -101,9 +101,11 @@
 
 	void saveCurrent();
 	void saveCurrentAs();
+	void openCurrentFile();
 	void reload();
 	void save(const KUrl&);
 	void saveAs(const KUrl&);
+	void openFile(const KUrl &);
 
 	void showDocumentInFullScreen(const KUrl&);
 	void rotateCurrentLeft();
Index: app/mainwindow.cpp
===================================================================
--- app/mainwindow.cpp	(revision 769171)
+++ app/mainwindow.cpp	(working copy)
@@ -259,6 +259,7 @@
 
 		KStandardAction::save(mWindow, SLOT(saveCurrent()), actionCollection);
 		KStandardAction::saveAs(mWindow, SLOT(saveCurrentAs()), actionCollection);
+		KStandardAction::open(mWindow, SLOT(openCurrentFile()), actionCollection);
 		KStandardAction::print(mWindow, SLOT(print()), actionCollection);
 		KStandardAction::quit(KApplication::kApplication(), SLOT(closeAllWindows()), actionCollection);
 
@@ -1094,7 +1095,22 @@
 	doc->save(dialog.selectedUrl(), typeList[0].toAscii());
 }
 
+void MainWindow::openCurrentFile() {
+	KUrl url = d->currentUrl();
 
+	openFile(url);
+}
+
+void MainWindow::openFile(const KUrl& url) {
+	KUrl file = KFileDialog::getOpenUrl(url);
+
+	if (file=="") {
+		return;
+	}
+	goToUrl(file);
+}
+
+
 void MainWindow::showDocumentInFullScreen(const KUrl& url) {
 	openDocumentUrl(url);
 	d->mFullScreenAction->trigger();