Commit dd5e2cea authored by Victor Wåhlström's avatar Victor Wåhlström

Added optional flags to KisDocument::openUrl() and made "File Layer" not add...

Added optional flags to KisDocument::openUrl() and made "File Layer" not add its file to the recent files list.

BUG:345560

REVIEW:124732
parent 0be0f828
......@@ -1202,7 +1202,7 @@ bool KisDocument::importDocument(const KUrl & _url)
}
bool KisDocument::openUrl(const KUrl & _url)
bool KisDocument::openUrl(const KUrl & _url, KisDocument::OpenUrlFlags flags)
{
kDebug(30003) << "url=" << _url.url();
d->lastErrorMessage.clear();
......@@ -1249,7 +1249,9 @@ bool KisDocument::openUrl(const KUrl & _url)
setModified(true);
}
else {
KisPart::instance()->addRecentURLToAllMainWindows(_url);
if( !(flags & OPEN_URL_FLAG_DO_NOT_ADD_TO_RECENT_FILES) ) {
KisPart::instance()->addRecentURLToAllMainWindows(_url);
}
if (ret) {
// Detect readonly local-files; remote files are assumed to be writable, unless we add a KIO::stat here (async).
......
......@@ -86,6 +86,11 @@ protected:
public:
enum OpenUrlFlags {
OPEN_URL_FLAG_NONE = 1 << 0,
OPEN_URL_FLAG_DO_NOT_ADD_TO_RECENT_FILES = 1 << 1,
};
/**
* Destructor.
*
......@@ -101,10 +106,12 @@ public:
virtual bool reload();
/**
* Reimplemented from KisParts::ReadWritePart for internal reasons
* (for the autosave functionality)
* @brief openUrl Open an URL
* @param url The URL to open
* @param flags Control specific behavior
* @return success status
*/
virtual bool openUrl(const KUrl & url);
virtual bool openUrl(const KUrl & url, OpenUrlFlags flags = OPEN_URL_FLAG_NONE);
/**
* Opens the document given by @p url, without storing the URL
......
......@@ -145,7 +145,8 @@ void KisSafeDocumentLoader::delayedLoadStart()
tempInfo.size() == m_d->initialFileSize) {
m_d->doc.reset(KisPart::instance()->createDocument());
successfullyLoaded = m_d->doc->openUrl(m_d->temporaryPath);
successfullyLoaded = m_d->doc->openUrl(m_d->temporaryPath,
KisDocument::OPEN_URL_FLAG_DO_NOT_ADD_TO_RECENT_FILES);
} else {
qDebug() << "File was modified externally. Restarting.";
qDebug() << ppVar(m_d->fileChangedFlag);
......
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