Commit a40cc7aa authored by David Jarvie's avatar David Jarvie
Browse files

Port KWindowSystem and X11 code to Qt5

parent 72593f0f
KAlarm Change Log
=== Version 2.12.3 (KDE Applications 19.04.2) --- 23 May 2019 ===
+ Fix calendar configuration dialogue not appearing.
+ Fix errors creating calendar resources on first run of KAlarm [KDE Bug 407544]
* Fix calendar configuration dialogue not appearing.
* Fix errors creating calendar resources on first run of KAlarm [KDE Bug 407544]
* Display alarm message windows within current screen in multi-head systems.
=== Version 2.12.2 (KDE Applications 18.08.2) --- 27 Sep 2018 ===
+ Fix Defer button being disabled for recurring alarms [KDE Bug 398658]
* Fix Defer button being disabled for recurring alarms [KDE Bug 398658]
=== Version 2.12.1 (KDE Applications 18.08.1) --- 18 Aug 2018 ===
+ Align and right adjust 'Time to' column values in main window [KDE Bug 397130]
+ Remove seconds values from Time column (erroneously added in 2.12.0).
* Align and right adjust 'Time to' column values in main window [KDE Bug 397130]
* Remove seconds values from Time column (erroneously added in 2.12.0).
=== Version 2.12.0 (KDE Applications 18.08) --- 29 Jul 2018 ===
+ Use KAlarmCal::KADateTime instead of deprecated KDateTime.
+ Remove 'clock time' option, in favour of local system time zone.
+ Fix times being truncated and showing ellipsis in main window [KDE Bug 365257]
+ Fix evaluation of work days.
+ Fix reminder-once alarms not being correctly loaded from calendar file.
+ Fix some regressions introduced in version 2.11.0, including:
* Use KAlarmCal::KADateTime instead of deprecated KDateTime.
* Remove 'clock time' option, in favour of local system time zone.
* Fix times being truncated and showing ellipsis in main window [KDE Bug 365257]
* Fix evaluation of work days.
* Fix reminder-once alarms not being correctly loaded from calendar file.
* Fix some regressions introduced in version 2.11.0, including:
Make global shortcuts available.
Default sound file selection dialogue to the system sound files directory.
=== Version 2.11.16 (KDE Applications 17.04.1) --- 15 April 2017 ===
+ Fix option text for using default email address from KMail/System Settings [KDE Bug 378722]
* Fix option text for using default email address from KMail/System Settings [KDE Bug 378722]
=== Version 2.11.15 (KDE Applications 17.04) --- 15 January 2017 ===
+ Report if terminal for command alarms is not configured.
+ Don't allow 'auto-hide in system tray' on Unity desktop [KDE Bug 373848]
* Report if terminal for command alarms is not configured.
* Don't allow 'auto-hide in system tray' on Unity desktop [KDE Bug 373848]
=== Version 2.11.14 --- 19 February 2017 ===
+ Fix not showing main window if activated again while already running with --tray [KDE Bug 374520]
+ Fix --help, --version and option errors not being reported if KAlarm is already running.
+ Make command options --edit-new-* work [KDE Bug 376209]
* Fix not showing main window if activated again while already running with --tray [KDE Bug 374520]
* Fix --help, --version and option errors not being reported if KAlarm is already running.
* Make command options --edit-new-* work [KDE Bug 376209]
=== Version 2.11.13 (KDE Applications 16.12.2) --- 29 January 2017 ===
+ Fix system tray icon used for "some alarms disabled"
+ Improved system tray icons (requires Plasma 5.9) [KDE Bug 362631]
+ Don't show misleading "Failed to update alarm" if command alarm fails [KDE Bug 375615]
* Fix system tray icon used for "some alarms disabled"
* Improved system tray icons (requires Plasma 5.9) [KDE Bug 362631]
* Don't show misleading "Failed to update alarm" if command alarm fails [KDE Bug 375615]
=== Version 2.11.12 (KDE Applications 16.12.1) --- 1 January 2017 ===
+ Fix Export Alarms file save error [KDE Bug 374337]
+ Fix arrow/page up/down keys not working in date edit control
* Fix Export Alarms file save error [KDE Bug 374337]
* Fix arrow/page up/down keys not working in date edit control
(needs KDE Frameworks 5.30) [KDE Bug 373886]
=== Version 2.11.11 (KDE Applications 16.12.0) --- 16 November 2016 ===
+ Fix crash on exit [KDE Bug 372223]
* Fix crash on exit [KDE Bug 372223]
=== Version 2.11.10 (KDE Applications 16.08.3) --- 31 October 2016 ===
+ Fix default calendar files not being created on first run [KDE Bug 362962]
+ Fix crash when a second instance of KAlarm is started [KDE Bug 371628]
+ Don't output error messages about temporary files in directory calendar [KDE Bug 370627]
* Fix default calendar files not being created on first run [KDE Bug 362962]
* Fix crash when a second instance of KAlarm is started [KDE Bug 371628]
* Don't output error messages about temporary files in directory calendar [KDE Bug 370627]
=== Version 2.11.9 (KDE Applications 16.08.1) --- 18 August 2016 ===
* Prevent KAlarm autostarting on non-KDE desktops if it has never been run [KDE Bug 366562]
......
......@@ -165,7 +165,7 @@ target_link_libraries(kalarm_bin
)
if (Qt5X11Extras_FOUND)
target_link_libraries(kalarm_bin Qt5::X11Extras)
target_link_libraries(kalarm_bin Qt5::X11Extras ${X11_X11_LIB})
endif()
......
/*
* find.cpp - search facility
* Program: kalarm
* Copyright © 2005-2013 by David Jarvie <djarvie@kde.org>
* Copyright © 2005-2019 David Jarvie <djarvie@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -25,7 +25,6 @@
#include "eventlistview.h"
#include "messagebox.h"
#include "preferences.h"
#include "config-kalarm.h"
#include <kalarmcal/kaevent.h>
......@@ -72,7 +71,7 @@ Find::Find(EventListView* parent)
Find::~Find()
{
delete mDialog; // automatically set to 0
delete mDialog; // automatically set to null
delete mFind;
mFind = nullptr;
}
......@@ -89,8 +88,10 @@ void Find::slotSelectionChanged()
void Find::display()
{
if (!mOptions)
{
// Set defaults the first time the Find dialog is activated
mOptions = FIND_LIVE | FIND_ARCHIVED | FIND_MESSAGE | FIND_FILE | FIND_COMMAND | FIND_EMAIL | FIND_AUDIO;
}
bool noArchived = !Preferences::archivedKeepDays();
bool showArchived = qobject_cast<AlarmListView*>(mListView)
&& (static_cast<AlarmListModel*>(mListView->model())->eventTypeFilter() & CalEvent::ARCHIVED);
......@@ -98,11 +99,7 @@ void Find::display()
mOptions &= ~FIND_ARCHIVED;
if (mDialog)
{
#if KDEPIM_HAVE_X11
KWindowSystem::activateWindow(mDialog->winId());
#endif
}
else
{
mDialog = new KFindDialog(mListView, mOptions, mHistory, (mListView->selectionModel()->selectedRows().count() > 1));
......
/*
* functions.cpp - miscellaneous functions
* Program: kalarm
* Copyright © 2001-2018 by David Jarvie <djarvie@kde.org>
* Copyright © 2001-2019 by David Jarvie <djarvie@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -69,6 +69,7 @@ using namespace KCalCore;
#if KDEPIM_HAVE_X11
#include <kwindowsystem.h>
#include <kwindowinfo.h>
#include <kxmessages.h>
#include <kstartupinfo.h>
#include <netwm.h>
......@@ -87,6 +88,11 @@ using namespace KCalCore;
#include <QTimeZone>
#include "kalarm_debug.h"
#if KDEPIM_HAVE_X11
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#endif
using namespace Akonadi;
......@@ -1415,10 +1421,8 @@ QString runKMail(bool minimise)
*/
bool Private::startKMailMinimised()
{
#pragma message("port QT5")
#if 0 //PORT QT5
#if KDEPIM_HAVE_X11
NETRootInfo i(QX11Info::display(), NET::Supported);
NETRootInfo i(QX11Info::connection(), NET::Supported, NET::Properties2());
if (i.isSupported(NET::WM2KDETemporaryRules))
{
qCDebug(KALARM_LOG) << "using rules";
......@@ -1434,7 +1438,7 @@ bool Private::startKMailMinimised()
{
// Connect to window add to get the NEW windows
qCDebug(KALARM_LOG) << "connecting to window add";
connect(KWindowSystem::self(), SIGNAL(windowAdded(WId)), instance(), SLOT(windowAdded(WId)));
connect(KWindowSystem::self(), &KWindowSystem::windowAdded, instance(), &Private::windowAdded);
}
// Propagate the app startup notification info to the started app.
// We are not using KApplication, so the env remained set.
......@@ -1456,9 +1460,6 @@ bool Private::startKMailMinimised()
#else
return false;
#endif
#else
return false;
#endif
}
/******************************************************************************
......@@ -1467,39 +1468,37 @@ bool Private::startKMailMinimised()
*/
void Private::windowAdded(WId w)
{
#pragma message("port QT5")
#if 0 //Port QT5
#if KDEPIM_HAVE_X11
static const int SUPPORTED_TYPES = NET::NormalMask | NET::DesktopMask | NET::DockMask
| NET::ToolbarMask | NET::MenuMask | NET::DialogMask
| NET::OverrideMask | NET::TopMenuMask | NET::UtilityMask | NET::SplashMask;
KWindowInfo kwinfo = KWindowSystem::windowInfo(w, NET::WMWindowType | NET::WMName);
static const NET::WindowTypes SUPPORTED_TYPES =
NET::NormalMask | NET::DesktopMask | NET::DockMask
| NET::ToolbarMask | NET::MenuMask | NET::DialogMask
| NET::OverrideMask | NET::TopMenuMask | NET::UtilityMask | NET::SplashMask;
KWindowInfo kwinfo(w, NET::WMWindowType | NET::WMName);
if (kwinfo.windowType(SUPPORTED_TYPES) == NET::TopMenu
|| kwinfo.windowType(SUPPORTED_TYPES) == NET::Toolbar
|| kwinfo.windowType(SUPPORTED_TYPES) == NET::Desktop)
return; // always ignore these window types
QX11Info qxinfo;
XWithdrawWindow(QX11Info::display(), w, qxinfo.screen());
Display* display = QX11Info::display();
XWithdrawWindow(display, w, QX11Info::appScreen());
QApplication::flush();
NETWinInfo info(QX11Info::display(), w, QX11Info::appRootWindow(), NET::WMState);
XWMHints* hints = XGetWMHints(QX11Info::display(), w);
NETWinInfo info(QX11Info::connection(), w, QX11Info::appRootWindow(), NET::WMState, NET::Properties2());
XWMHints* hints = XGetWMHints(display, w);
if (hints)
{
hints->flags |= StateHint;
hints->initial_state = IconicState;
XSetWMHints(QX11Info::display(), w, hints);
XSetWMHints(display, w, hints);
XFree(hints);
}
info.setWindowType(NET::Normal);
XSync(QX11Info::display(), False);
XMapWindow(QX11Info::display(), w);
XSync(QX11Info::display(), False);
XSync(display, False);
XMapWindow(display, w);
XSync(display, False);
QApplication::flush();
#endif
#endif
}
/******************************************************************************
......
/*
* messagewin.cpp - displays an alarm message
* Program: kalarm
* Copyright © 2001-2018 by David Jarvie <djarvie@kde.org>
* Copyright © 2001-2019 by David Jarvie <djarvie@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -39,9 +39,6 @@
#include "synchtimer.h"
#include <kpimtextedit/texttospeech.h>
#pragma message("port QT5")
//QT5 reactivate after porting (activated by config-kalarm.h include in texttospeech.h)
#define KDEPIM_HAVE_X11 0
#include <KAboutData>
#include <kstandardguiitem.h>
......@@ -59,6 +56,7 @@
#include <phonon/audiooutput.h>
#include <phonon/volumefadereffect.h>
#if KDEPIM_HAVE_X11
#include <kwindowinfo.h>
#include <netwm.h>
#include <qx11info_x11.h>
#endif
......@@ -2354,18 +2352,18 @@ qCDebug(KALARM_LOG)<<"full="<<full<<", screen="<<mScreenNumber;
FullScreenType haveFullScreenWindow(int screen)
{
FullScreenType type = NoFullScreen;
Display* display = QX11Info::display();
const NETRootInfo rootInfo(display, NET::ClientList | NET::ActiveWindow, screen);
const Window rootWindow = rootInfo.rootWindow();
const Window activeWindow = rootInfo.activeWindow();
const Window* windows = rootInfo.clientList();
const int windowCount = rootInfo.clientListCount();
xcb_connection_t* connection = QX11Info::connection();
const NETRootInfo rootInfo(connection, NET::ClientList | NET::ActiveWindow, NET::Properties2(), screen);
const xcb_window_t rootWindow = rootInfo.rootWindow();
const xcb_window_t activeWindow = rootInfo.activeWindow();
const xcb_window_t* windows = rootInfo.clientList();
const int windowCount = rootInfo.clientListCount();
qCDebug(KALARM_LOG)<<"Screen"<<screen<<": Window count="<<windowCount<<", active="<<activeWindow<<", geom="<<qApp->desktop()->screenGeometry(screen);
NETRect geom;
NETRect frame;
for (int w = 0; w < windowCount; ++w)
{
NETWinInfo winInfo(display, windows[w], rootWindow, NET::WMState|NET::WMGeometry);
NETWinInfo winInfo(connection, windows[w], rootWindow, NET::WMState|NET::WMGeometry, NET::Properties2());
winInfo.kdeGeometry(frame, geom);
const QRect fr(frame.pos.x, frame.pos.y, frame.size.width, frame.size.height);
const QRect gm(geom.pos.x, geom.pos.y, geom.size.width, geom.size.height);
......@@ -2389,18 +2387,18 @@ FullScreenType findFullScreenWindows(const QVector<QRect>& screenRects, QVector<
{
FullScreenType result = NoFullScreen;
screenTypes.fill(NoFullScreen);
Display* display = QX11Info::display();
const NETRootInfo rootInfo(display, NET::ClientList | NET::ActiveWindow, 0);
const Window rootWindow = rootInfo.rootWindow();
const Window activeWindow = rootInfo.activeWindow();
const Window* windows = rootInfo.clientList();
const int windowCount = rootInfo.clientListCount();
xcb_connection_t* connection = QX11Info::connection();
const NETRootInfo rootInfo(connection, NET::ClientList | NET::ActiveWindow, NET::Properties2());
const xcb_window_t rootWindow = rootInfo.rootWindow();
const xcb_window_t activeWindow = rootInfo.activeWindow();
const xcb_window_t* windows = rootInfo.clientList();
const int windowCount = rootInfo.clientListCount();
qCDebug(KALARM_LOG)<<"Virtual desktops: Window count="<<windowCount<<", active="<<activeWindow<<", geom="<<qApp->desktop()->screenGeometry(0);
NETRect netgeom;
NETRect netframe;
for (int w = 0; w < windowCount; ++w)
{
NETWinInfo winInfo(display, windows[w], rootWindow, NET::WMState | NET::WMGeometry);
NETWinInfo winInfo(connection, windows[w], rootWindow, NET::WMState | NET::WMGeometry, NET::Properties2());
if (winInfo.state() & NET::FullScreen)
{
// Found a full screen window - find which screen it's on
......
Supports Markdown
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