Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Plasma
Plasma Phone Components
Commits
d5b65037
Commit
d5b65037
authored
Jun 24, 2015
by
Eike Hein
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Port to PlasmaWindowModel.
parent
758d3694
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
19 deletions
+28
-19
containments/taskpanel/package/contents/ui/Task.qml
containments/taskpanel/package/contents/ui/Task.qml
+2
-2
containments/taskpanel/package/contents/ui/TaskSwitcher.qml
containments/taskpanel/package/contents/ui/TaskSwitcher.qml
+9
-15
containments/taskpanel/taskpanel.cpp
containments/taskpanel/taskpanel.cpp
+9
-0
containments/taskpanel/taskpanel.h
containments/taskpanel/taskpanel.h
+8
-2
No files found.
containments/taskpanel/package/contents/ui/Task.qml
View file @
d5b65037
...
@@ -46,7 +46,7 @@ Item {
...
@@ -46,7 +46,7 @@ Item {
ScriptAction
{
ScriptAction
{
script
:
{
script
:
{
if
(
background
.
x
!=
0
)
{
if
(
background
.
x
!=
0
)
{
window
.
executeJob
(
"
c
lose
"
,
model
.
Id
);
plasmoid
.
nativeInterface
.
windowModel
.
requestC
lose
(
model
.
index
);
}
}
}
}
}
}
...
@@ -83,7 +83,7 @@ Item {
...
@@ -83,7 +83,7 @@ Item {
onPressed
:
delegate
.
z
=
10
;
onPressed
:
delegate
.
z
=
10
;
onClicked
:
{
onClicked
:
{
window
.
hide
();
window
.
hide
();
window
.
executeJob
(
"
a
ctivate
"
,
model
.
Id
);
plasmoid
.
nativeInterface
.
windowModel
.
requestA
ctivate
(
model
.
index
);
}
}
onReleased
:
{
onReleased
:
{
delegate
.
z
=
0
;
delegate
.
z
=
0
;
...
...
containments/taskpanel/package/contents/ui/TaskSwitcher.qml
View file @
d5b65037
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
import
QtQuick
2.0
import
QtQuick
2.0
import
QtQuick
.
Layouts
1.1
import
QtQuick
.
Layouts
1.1
import
QtQuick
.
Window
2.2
import
QtQuick
.
Window
2.2
import
org
.
kde
.
plasma
.
core
2.
0
as
PlasmaCore
import
org
.
kde
.
plasma
.
core
2.
1
as
PlasmaCore
import
org
.
kde
.
plasma
.
components
2.0
as
PlasmaComponents
import
org
.
kde
.
plasma
.
components
2.0
as
PlasmaComponents
import
org
.
kde
.
plasma
.
mobilecomponents
0.2
import
org
.
kde
.
plasma
.
mobilecomponents
0.2
...
@@ -56,19 +56,6 @@ FullScreenPanel {
...
@@ -56,19 +56,6 @@ FullScreenPanel {
scrollAnim
.
running
=
true
;
scrollAnim
.
running
=
true
;
}
}
PlasmaCore.DataSource
{
id
:
tasksSource
engine
:
"
tasks
"
connectedSources
:
"
tasks
"
}
function
executeJob
(
operationName
,
id
)
{
var
service
=
tasksSource
.
serviceForSource
(
"
tasks
"
);
var
operation
=
service
.
operationDescription
(
operationName
);
operation
.
Id
=
id
;
service
.
startOperationCall
(
operation
);
}
SequentialAnimation
{
SequentialAnimation
{
id
:
scrollAnim
id
:
scrollAnim
property
alias
to
:
internalAnim
.
to
property
alias
to
:
internalAnim
.
to
...
@@ -140,7 +127,14 @@ FullScreenPanel {
...
@@ -140,7 +127,14 @@ FullScreenPanel {
}
}
}
}
model
:
tasksSource
.
models
.
tasks
PlasmaCore.SortFilterModel
{
id
:
filteredWindowModel
filterRole
:
"
DisplayRole
"
filterRegExp
:
"
.+
"
sourceModel
:
plasmoid
.
nativeInterface
.
windowModel
}
model
:
filteredWindowModel
header
:
Item
{
header
:
Item
{
width
:
window
.
width
width
:
window
.
width
height
:
window
.
height
height
:
window
.
height
...
...
containments/taskpanel/taskpanel.cpp
View file @
d5b65037
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
#include <KWayland/Client/connection_thread.h>
#include <KWayland/Client/connection_thread.h>
#include <KWayland/Client/plasmawindowmanagement.h>
#include <KWayland/Client/plasmawindowmanagement.h>
#include <KWayland/Client/plasmawindowmodel.h>
#include <KWayland/Client/registry.h>
#include <KWayland/Client/registry.h>
static
const
QString
s_kwinService
=
QStringLiteral
(
"org.kde.KWin"
);
static
const
QString
s_kwinService
=
QStringLiteral
(
"org.kde.KWin"
);
...
@@ -66,6 +67,9 @@ void TaskPanel::initWayland()
...
@@ -66,6 +67,9 @@ void TaskPanel::initWayland()
connect
(
registry
,
&
Registry
::
plasmaWindowManagementAnnounced
,
this
,
connect
(
registry
,
&
Registry
::
plasmaWindowManagementAnnounced
,
this
,
[
this
,
registry
]
(
quint32
name
,
quint32
version
)
{
[
this
,
registry
]
(
quint32
name
,
quint32
version
)
{
m_windowManagement
=
registry
->
createPlasmaWindowManagement
(
name
,
version
,
this
);
m_windowManagement
=
registry
->
createPlasmaWindowManagement
(
name
,
version
,
this
);
qRegisterMetaType
<
QVector
<
int
>
>
(
"QVector<int>"
);
m_windowModel
=
m_windowManagement
->
createWindowModel
();
emit
windowModelChanged
();
connect
(
m_windowManagement
,
&
PlasmaWindowManagement
::
showingDesktopChanged
,
this
,
connect
(
m_windowManagement
,
&
PlasmaWindowManagement
::
showingDesktopChanged
,
this
,
[
this
]
(
bool
showing
)
{
[
this
]
(
bool
showing
)
{
if
(
showing
==
m_showingDesktop
)
{
if
(
showing
==
m_showingDesktop
)
{
...
@@ -82,6 +86,11 @@ void TaskPanel::initWayland()
...
@@ -82,6 +86,11 @@ void TaskPanel::initWayland()
registry
->
setup
();
registry
->
setup
();
}
}
QAbstractItemModel
*
TaskPanel
::
windowModel
()
const
{
return
m_windowModel
;
}
void
TaskPanel
::
updateActiveWindow
()
void
TaskPanel
::
updateActiveWindow
()
{
{
if
(
!
m_windowManagement
)
{
if
(
!
m_windowManagement
)
{
...
...
containments/taskpanel/taskpanel.h
View file @
d5b65037
...
@@ -21,21 +21,24 @@
...
@@ -21,21 +21,24 @@
#ifndef TASKPANEL_H
#ifndef TASKPANEL_H
#define TASKPANEL_H
#define TASKPANEL_H
#include <Plasma/Containment>
#include <Plasma/Containment>
class
QAbstractItemModel
;
namespace
KWayland
namespace
KWayland
{
{
namespace
Client
namespace
Client
{
{
class
PlasmaWindowManagement
;
class
PlasmaWindowManagement
;
class
PlasmaWindow
;
class
PlasmaWindow
;
class
PlasmaWindowModel
;
}
}
}
}
class
TaskPanel
:
public
Plasma
::
Containment
class
TaskPanel
:
public
Plasma
::
Containment
{
{
Q_OBJECT
Q_OBJECT
Q_PROPERTY
(
QAbstractItemModel
*
windowModel
READ
windowModel
NOTIFY
windowModelChanged
)
Q_PROPERTY
(
bool
showDesktop
READ
isShowingDesktop
WRITE
requestShowingDesktop
NOTIFY
showingDesktopChanged
)
Q_PROPERTY
(
bool
showDesktop
READ
isShowingDesktop
WRITE
requestShowingDesktop
NOTIFY
showingDesktopChanged
)
Q_PROPERTY
(
bool
hasCloseableActiveWindow
READ
hasCloseableActiveWindow
NOTIFY
hasCloseableActiveWindowChanged
)
Q_PROPERTY
(
bool
hasCloseableActiveWindow
READ
hasCloseableActiveWindow
NOTIFY
hasCloseableActiveWindowChanged
)
...
@@ -43,6 +46,8 @@ public:
...
@@ -43,6 +46,8 @@ public:
TaskPanel
(
QObject
*
parent
,
const
QVariantList
&
args
);
TaskPanel
(
QObject
*
parent
,
const
QVariantList
&
args
);
~
TaskPanel
();
~
TaskPanel
();
QAbstractItemModel
*
windowModel
()
const
;
Q_INVOKABLE
void
closeActiveWindow
();
Q_INVOKABLE
void
closeActiveWindow
();
bool
isShowingDesktop
()
const
{
bool
isShowingDesktop
()
const
{
...
@@ -53,6 +58,7 @@ public:
...
@@ -53,6 +58,7 @@ public:
bool
hasCloseableActiveWindow
()
const
;
bool
hasCloseableActiveWindow
()
const
;
Q_SIGNALS:
Q_SIGNALS:
void
windowModelChanged
();
void
showingDesktopChanged
(
bool
);
void
showingDesktopChanged
(
bool
);
void
hasCloseableActiveWindowChanged
();
void
hasCloseableActiveWindowChanged
();
...
@@ -61,8 +67,8 @@ private:
...
@@ -61,8 +67,8 @@ private:
void
updateActiveWindow
();
void
updateActiveWindow
();
bool
m_showingDesktop
;
bool
m_showingDesktop
;
KWayland
::
Client
::
PlasmaWindowManagement
*
m_windowManagement
;
KWayland
::
Client
::
PlasmaWindowManagement
*
m_windowManagement
;
KWayland
::
Client
::
PlasmaWindowModel
*
m_windowModel
=
nullptr
;
KWayland
::
Client
::
PlasmaWindow
*
m_activeWindow
=
nullptr
;
KWayland
::
Client
::
PlasmaWindow
*
m_activeWindow
=
nullptr
;
};
};
#endif
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment