Commit 0db8495c authored by Georg Gadinger's avatar Georg Gadinger 🐾
Browse files

set the windowFilePath property to have a proxy icon on macOS

On macOS applications that work with documents can set a proxy
icon on the window for the file you're currently editing.  This
allows a user to e.g. drag it into another application without
having to browse to the file manually.

To display the correct icon for the file I removed the call to
setWindowIcon on macOS, otherwise a Kate/KWrite icon would be
shown at all times.
parent 90cf5ed1
Pipeline #142702 passed with stage
in 5 minutes and 42 seconds
......@@ -1037,6 +1037,7 @@ void KateMainWindow::updateCaption(KTextEditor::Document *doc)
{
if (!m_viewManager->activeView()) {
setCaption(QString(), false);
setWindowFilePath(QString());
return;
}
......@@ -1057,6 +1058,8 @@ void KateMainWindow::updateCaption(KTextEditor::Document *doc)
}
}
setWindowFilePath(m_viewManager->activeView()->document()->url().toString(QUrl::PreferLocalFile));
QString sessName = KateApp::self()->sessionManager()->activeSession()->name();
if (!sessName.isEmpty()) {
sessName = QStringLiteral("%1: ").arg(sessName);
......
......@@ -210,7 +210,9 @@ int main(int argc, char **argv)
/**
* set the program icon
*/
#ifndef Q_OS_MACOS // skip this on macOS to have proper mime-type icon visible
QApplication::setWindowIcon(QIcon(QStringLiteral(":/kate/kate.svg")));
#endif
/**
* Create command line parser and feed it with known options
......
......@@ -443,6 +443,7 @@ void KWrite::documentNameChanged()
if (m_view->document()->url().isEmpty()) {
setCaption(i18n("Untitled") + readOnlyCaption + QStringLiteral(" [*]"), m_view->document()->isModified());
setWindowFilePath(QString());
return;
}
......@@ -469,6 +470,8 @@ void KWrite::documentNameChanged()
}
}
setWindowFilePath(m_view->document()->url().toString(QUrl::PreferLocalFile));
setCaption(c + readOnlyCaption + QStringLiteral(" [*]"), m_view->document()->isModified());
}
......
......@@ -181,7 +181,9 @@ extern "C" Q_DECL_EXPORT int main(int argc, char **argv)
/**
* set the program icon
*/
#ifndef Q_OS_MACOS // skip this on macOS to have proper mime-type icon visible
QApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("accessories-text-editor"), app.windowIcon()));
#endif
/**
* Create command line parser and feed it with known options
......
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