Commit 64e876db authored by Arjen Hiemstra's avatar Arjen Hiemstra
Browse files

gemini: Use the desktop dialog for opening images from the welcome screen

parent eb76befa
......@@ -37,6 +37,7 @@
#include <QToolButton>
#include <QFileInfo>
#include <QGLWidget>
#include <QDesktopServices>
#include <kcmdlineargs.h>
#include <kurl.h>
......@@ -54,6 +55,9 @@
#include <KoDocumentInfo.h>
#include <KoAbstractGradient.h>
#include <KoZoomController.h>
#include <KoFileDialog.h>
#include <KoDocumentEntry.h>
#include <KoFilterManager.h>
#include "filter/kis_filter.h"
#include "filter/kis_filter_registry.h"
......@@ -524,6 +528,20 @@ void MainWindow::setTemporaryFile(bool newValue)
emit temporaryFileChanged();
}
QString MainWindow::openImage()
{
KoFileDialog dialog(this, KoFileDialog::OpenFile, "OpenDocument");
dialog.setCaption(i18n("Open Document"));
dialog.setDefaultDir(QDesktopServices::storageLocation(QDesktopServices::PicturesLocation));
KoDocumentEntry entry = KoDocumentEntry::queryByMimeType("application/x-krita");
KService::Ptr service = entry.service();
dialog.setMimeTypeFilters(KoFilterManager::mimeFilter("application/x-krita", KoFilterManager::Import, service->property("X-KDE-ExtraNativeMimeTypes").toStringList()));
dialog.setHideNameFilterDetailsOption();
return dialog.url();
}
void MainWindow::resourceChanged(int key, const QVariant& v)
{
if(centralWidget() == d->sketchView)
......
......@@ -59,6 +59,8 @@ public:
virtual void closeEvent(QCloseEvent* event);
Q_INVOKABLE QString openImage();
bool forceFullScreen();
void forceFullScreen(bool newValue);
public Q_SLOTS:
......@@ -71,6 +73,7 @@ public Q_SLOTS:
void resetWindowTitle();
void resourceChanged(int key, const QVariant& v);
void resourceChangedSketch(int key, const QVariant& v);
Q_SIGNALS:
void closeRequested();
void switchedToSketch();
......
......@@ -237,7 +237,14 @@ Page {
baseLoadingDialog.visible = true;
Settings.currentFile = file;
} else {
pageStack.push(openImagePage);
if(Krita.Window.slateMode) {
pageStack.push(openImagePage);
} else {
var path = Krita.Window.openImage();
if(path !== "") {
openImage(path);
}
}
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment