With this commit, Quassel uses a proper KMainWindow if KF5 integration
is enabled. This works pretty much like the KDE4 version, so we just had
to add the appropriate #includes and adapt the #ifdefs.
- find_package(KF5CoreAddons QUIET)
- set_package_properties(KF5CoreAddons PROPERTIES TYPE REQUIRED
- URL "http://inqlude.org/libraries/kcoreaddons.html"
- DESCRIPTION "framework for solving common problems such as caching, randomization, and more"
- PURPOSE "Required for KDE Frameworks integration"
- )
-
- find_package(KF5TextWidgets QUIET)
- set_package_properties(KF5TextWidgets PROPERTIES TYPE REQUIRED
- URL "http://inqlude.org/libraries/ktextwidgets.html"
- DESCRIPTION "framework providing an assortment of widgets for displaying and editing text"
- PURPOSE "Allows to use extra features provided by KDE Frameworks in input widgets"
+ find_package(KF5 COMPONENTS ConfigWidgets CoreAddons TextWidgets XmlGui QUIET)
+ set_package_properties(KF5 PROPERTIES TYPE REQUIRED
+ URL "http://www.kde.org"
+ DESCRIPTION "KDE Frameworks"
+ PURPOSE "Required for integration into the Plasma desktop"
)
endif()
endif(BUILD_GUI)
)
endif()
endif(BUILD_GUI)
if (BUILD_CORE)
find_package(Qt5Script QUIET)
set_package_properties(Qt5Script PROPERTIES TYPE REQUIRED
if (BUILD_CORE)
find_package(Qt5Script QUIET)
set_package_properties(Qt5Script PROPERTIES TYPE REQUIRED
DESCRIPTION "contains tools for handling translation files"
PURPOSE "Required for having translations"
)
DESCRIPTION "contains tools for handling translation files"
PURPOSE "Required for having translations"
)
# Some Qt5 versions do not define a target for lconvert, so we need to find it ourselves
if (Qt5LinguistTools_FOUND)
if (NOT TARGET Qt5::lconvert AND TARGET Qt5::lrelease)
# Some Qt5 versions do not define a target for lconvert, so we need to find it ourselves
if (Qt5LinguistTools_FOUND)
if (NOT TARGET Qt5::lconvert AND TARGET Qt5::lrelease)
set(LIBS )
set(QT_MODULES )
set(LIBS )
set(QT_MODULES )
add_definitions(-DHAVE_KDE ${KDE4_DEFINITIONS})
include_directories(${KDE4_INCLUDES})
list(APPEND SOURCES knotificationbackend.cpp)
list(APPEND LIBS ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBRARY} ${KDE4_KNOTIFYCONFIG_LIBRARY})
endif()
add_definitions(-DHAVE_KDE ${KDE4_DEFINITIONS})
include_directories(${KDE4_INCLUDES})
list(APPEND SOURCES knotificationbackend.cpp)
list(APPEND LIBS ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBRARY} ${KDE4_KNOTIFYCONFIG_LIBRARY})
endif()
+if (WITH_KF5)
+ list(APPEND LIBS KF5::ConfigWidgets KF5::XmlGui)
+endif()
+
if (LIBSNORE_FOUND)
add_definitions(-DHAVE_LIBSNORE)
include_directories(${LIBSNORE_INCLUDE_DIRS})
if (LIBSNORE_FOUND)
add_definitions(-DHAVE_LIBSNORE)
include_directories(${LIBSNORE_INCLUDE_DIRS})
# include <KWindowSystem>
#endif
# include <KWindowSystem>
#endif
+#ifdef HAVE_KF5
+# include <KConfigWidgets/KStandardAction>
+# include <KXmlGui/KHelpMenu>
+#endif
+
#ifdef Q_WS_X11
# include <QX11Info>
#endif
#ifdef Q_WS_X11
# include <QX11Info>
#endif
#endif
MainWin::MainWin(QWidget *parent)
#endif
MainWin::MainWin(QWidget *parent)
-#ifdef HAVE_KDE4
- : KMainWindow(parent),
- _kHelpMenu(new KHelpMenu(this, KGlobal::mainComponent().aboutData())),
+#ifdef HAVE_KDE
+ : KMainWindow(parent), _kHelpMenu(new KHelpMenu(this)),
#else
: QMainWindow(parent),
#endif
#else
: QMainWindow(parent),
#endif
setDisconnectedState(); // Disable menus and stuff
setDisconnectedState(); // Disable menus and stuff
setAutoSaveSettings();
#endif
setAutoSaveSettings();
#endif
if (lastBufId.isValid())
s.setValue("LastUsedBufferId", lastBufId.toInt());
if (lastBufId.isValid())
s.setValue("LastUsedBufferId", lastBufId.toInt());
saveAutoSaveSettings();
#endif
}
saveAutoSaveSettings();
#endif
}
_normalPos = s.value("MainWinPos", pos()).toPoint();
bool maximized = s.value("MainWinMaximized", false).toBool();
_normalPos = s.value("MainWinPos", pos()).toPoint();
bool maximized = s.value("MainWinMaximized", false).toBool();
restoreGeometry(s.value("MainWinGeometry").toByteArray());
if (maximized) {
restoreGeometry(s.value("MainWinGeometry").toByteArray());
if (maximized) {
configureShortcutsAct->setMenuRole(QAction::NoRole);
coll->addAction("ConfigureShortcuts", configureShortcutsAct);
configureShortcutsAct->setMenuRole(QAction::NoRole);
coll->addAction("ConfigureShortcuts", configureShortcutsAct);
QAction *configureQuasselAct = new Action(QIcon::fromTheme("configure"), tr("&Configure Quassel..."), coll,
this, SLOT(showSettingsDlg()));
configureQuasselAct->setMenuRole(QAction::PreferencesRole);
QAction *configureQuasselAct = new Action(QIcon::fromTheme("configure"), tr("&Configure Quassel..."), coll,
this, SLOT(showSettingsDlg()));
configureQuasselAct->setMenuRole(QAction::PreferencesRole);
QAction *configureQuasselAct = new Action(QIcon::fromTheme("configure"), tr("&Configure Quassel..."), coll,
this, SLOT(showSettingsDlg()), QKeySequence(Qt::Key_F7));
QAction *configureQuasselAct = new Action(QIcon::fromTheme("configure"), tr("&Configure Quassel..."), coll,
this, SLOT(showSettingsDlg()), QKeySequence(Qt::Key_F7));
coll->addAction("ConfigureQuassel", configureQuasselAct);
// Help
coll->addAction("ConfigureQuassel", configureQuasselAct);
// Help
_settingsMenu->addAction(coll->action("ConfigureQuassel"));
_helpMenu = menuBar()->addMenu(tr("&Help"));
_settingsMenu->addAction(coll->action("ConfigureQuassel"));
_helpMenu = menuBar()->addMenu(tr("&Help"));
_helpMenu->addAction(coll->action("AboutQuassel"));
_helpMenu->addAction(coll->action("AboutQuassel"));
_helpMenu->addAction(coll->action("AboutQt"));
#else
_helpMenu->addAction(KStandardAction::aboutKDE(_kHelpMenu, SLOT(aboutKDE()), this));
_helpMenu->addAction(coll->action("AboutQt"));
#else
_helpMenu->addAction(KStandardAction::aboutKDE(_kHelpMenu, SLOT(aboutKDE()), this));
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef MAINWIN_H_
-#define MAINWIN_H_
#ifdef HAVE_KDE4
# include <KMainWindow>
#ifdef HAVE_KDE4
# include <KMainWindow>
+#elif defined HAVE_KF5
+# include <KXmlGui/KMainWindow>
#else
# include <QMainWindow>
#endif
#else
# include <QMainWindow>
#endif
//!\brief The main window of Quassel's QtUi.
class MainWin
//!\brief The main window of Quassel's QtUi.
class MainWin
-#ifdef HAVE_KDE4
- : public KMainWindow
-{
+#ifdef HAVE_KDE
+ : public KMainWindow {
void disconnectFromCore();
private:
void disconnectFromCore();
private:
KHelpMenu *_kHelpMenu;
#endif
KHelpMenu *_kHelpMenu;
#endif