diff --git a/share/CMakeLists.txt b/share/CMakeLists.txt index 63649b27d..ebdab010a 100644 --- a/share/CMakeLists.txt +++ b/share/CMakeLists.txt @@ -20,4 +20,7 @@ install(FILES ${DATABASE_ICONS} DESTINATION ${DATA_INSTALL_DIR}/icons/database) if(UNIX AND NOT APPLE) install(DIRECTORY icons/application/ DESTINATION share/icons/hicolor FILES_MATCHING PATTERN "*.png" PATTERN "*.svg") +else(UNIX AND NOT APPLE) + install(DIRECTORY icons/application/ DESTINATION ${DATA_INSTALL_DIR}/icons/application + FILES_MATCHING PATTERN "*.png" PATTERN "*.svg") endif(UNIX AND NOT APPLE) diff --git a/src/core/DataPath.cpp b/src/core/DataPath.cpp index a69463c4c..8e7991c96 100644 --- a/src/core/DataPath.cpp +++ b/src/core/DataPath.cpp @@ -33,6 +33,28 @@ QString DataPath::getPath(const QString& name) return m_instance->m_basePath + name; } +QIcon DataPath::applicationIcon() +{ + if (!m_instance) { + m_instance = new DataPath(); + } + + QIcon icon = QIcon::fromTheme("keepassx"); + +#if defined(QT_DEBUG) || defined(Q_WS_MAC) || defined(Q_WS_WIN) + if (icon.isNull()) { + QStringList pngSizes; + pngSizes << "16" << "24" << "32" << "48" << "64" << "128"; + Q_FOREACH (const QString& size, pngSizes) { + icon.addFile(QString("%1/icons/application/%2x%2/apps/keepassx.png").arg(m_instance->m_basePath, size)); + } + icon.addFile(QString("%1/icons/application/scalable/apps/keepassx.svg").arg(m_instance->m_basePath)); + } +#endif + + return icon; +} + DataPath::DataPath() { if (false) { diff --git a/src/core/DataPath.h b/src/core/DataPath.h index 7d1056065..8c5639b83 100644 --- a/src/core/DataPath.h +++ b/src/core/DataPath.h @@ -19,11 +19,13 @@ #define KEEPASSX_DATAPATH_H #include +#include class DataPath { public: static QString getPath(const QString& name); + static QIcon applicationIcon(); private: DataPath(); diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index f8cb7d00e..51796e810 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -19,6 +19,7 @@ #include "ui_MainWindow.h" #include "core/Database.h" +#include "core/DataPath.h" #include "core/Metadata.h" #include "gui/DatabaseWidget.h" @@ -27,6 +28,8 @@ MainWindow::MainWindow() { m_ui->setupUi(this); + setWindowIcon(DataPath::applicationIcon()); + connect(m_ui->tabWidget, SIGNAL(currentChanged(int)), SLOT(currentTabChanged(int))); connect(m_ui->tabWidget, SIGNAL(entrySelectionChanged(bool)), m_ui->actionEntryEdit, SLOT(setEnabled(bool))); connect(m_ui->tabWidget, SIGNAL(entrySelectionChanged(bool)), m_ui->actionEntryDelete, SLOT(setEnabled(bool)));