Commit Graph

312 Commits

Author SHA1 Message Date
Marco Martin
af00946f81 don't multiply svg sizes by devicepixelratio
Summary:
when the native high dpi scaling is enabled, some things gets scaled two times,
as sizes taken from svgs should *not* be manually scaled by devicePixelRatio

Test Plan:
works correctly on wayland, svg.elementSize will have to be tweaked in x11 to
return a value scaled by scalefactor, to homogenize the behavior compared to
native qt high dpi scaling.
to return a value scaled by scalefactor for this qml code to work there too.
I advise everybody with high dpi laptops to test this on both wayland and x11

Reviewers: #plasma, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: hein, broulik, plasma-devel, #frameworks

Tags: #plasma, #frameworks

Differential Revision: https://phabricator.kde.org/D9286
2018-01-23 15:58:55 +01:00
Laurent Montel
d1949d9149 Const'ify, use nullptr 2017-12-25 18:41:50 +01:00
Montel Laurent
7f0c023d3f Use nullptr + add explicit 2017-12-13 07:36:22 +01:00
Aleix Pol
1f9b5ed657 Performance
Summary:
Remove splitting + joining of a string just to remove the beginning of a
string.
Remove double look-up.
Solves Clazy warnings

Reviewers: #frameworks, #plasma, hein

Reviewed By: #plasma, hein

Subscribers: hein, plasma-devel

Tags: #plasma, #frameworks

Differential Revision: https://phabricator.kde.org/D9109
2017-12-02 16:22:03 +01:00
Aleix Pol
b8b8a69fd1 Remove implicit string casting
Summary: Follow the KF5 guidelines

Test Plan: Plasma shell starts

Reviewers: #plasma, #frameworks, sebas

Reviewed By: #plasma, sebas

Subscribers: plasma-devel

Tags: #plasma, #frameworks

Differential Revision: https://phabricator.kde.org/D9108
2017-12-02 15:44:14 +01:00
Kai Uwe Broulik
facaaf93d0 [PlasmaComponents Menu] Set WA_TranslucentBackground on the underlying QMenu
This ensures the menu can have nice round corners with Breeze and Oxygen. The same had already been done in ContainmentInterface's menu.

CHANGELOG: Fixed an issue where PlasmaComponents Menu would appear with broken corners

CCBUG: 381799

Differential Revision: https://phabricator.kde.org/D8965
2017-11-24 10:40:48 +01:00
Kai Uwe Broulik
c52a6c5748 [PlasmaComponents Menu] Add ungrabMouseHack
Ensures the PlasmaComponents.Menu doesn't confuse MouseArea states.

Differential Revision: https://phabricator.kde.org/D8445
2017-10-25 15:09:49 +02:00
Kai Uwe Broulik
c707f6074c Remove unused functions
You can just use mapToItem(null, 0, 0)
2017-09-18 15:12:45 +02:00
Kai Uwe Broulik
7482bef085 Pass item to rootObject() since it's now a singleton
The "parent" used to be resolved by the place where the utils.js was imported from.
However, it was changed into a singleton and now this didn't work.

BUG: 384776
2017-09-18 15:11:09 +02:00
David Edmundson
7141ad1721 Don't list tab names twice
Summary:
The name (with a correct role) is already exported as a tab

By having the static text internally we get the name twice when we do a
flat review of the controls.

Reviewers: #plasma

Subscribers: plasma-devel, #frameworks

Tags: #plasma, #frameworks

Differential Revision: https://phabricator.kde.org/D7815
2017-09-14 14:50:57 +02:00
Kai Uwe Broulik
d8f1d44a49 Declare AppManager.js as pragma library
It doesn't store any state but contains only functions.

Differential Revision: https://phabricator.kde.org/D6676
2017-07-13 14:27:59 +02:00
Kai Uwe Broulik
1d0a0b5cdf [PlasmaComponents] Remove Config.js
It got redundant and since it wasn't declared as "pragma library" an instance
of this script was created for every ListItem, causing quite some memory consumption.

Reviewed-By: notmart
2017-07-13 14:04:05 +02:00
Kai Uwe Broulik
21f954d94d [PlasmaComponents Menu] Don't crash on null action
You can assign a QAction as "action", this way you can just pass it e.g. plasmoid.action("configure").
However, when assigning a null action as can happen with kiosk restrictions, it would crash
as it assigns m_action the nullptr but never checks for that.

This patch ensures we always have a QAction, creating a new empty one, if neccessary.
Also deletes our own action if an external one is assigned

Differential Revision: https://phabricator.kde.org/D6608
2017-07-11 12:23:39 +02:00
David Edmundson
06410e779b Fix tab bar layout key handling in RTL
Summary:
Current code will, when mirrored, treat all keys like they're the left
key.

BUG: 379894

Test Plan: Ran plasma in RTL

Reviewers: #plasma, broulik

Reviewed By: #plasma, broulik

Subscribers: plasma-devel, #frameworks

Tags: #plasma, #frameworks

Differential Revision: https://phabricator.kde.org/D6480
2017-07-03 11:31:46 +01:00
Marco Martin
1aea7bbd5e show show password button also if empty text
like happened in KPasswordWidget, show the show password
button also when there is no text, otherwise is impossible
to know what will be typed, a dot or the actual letter
BUG: 378277
2017-06-09 13:15:46 +02:00
Marco Martin
680a8a9e28 [WIP] workarounds for menu positioning
Summary:
this ensure two things:
* submenus have the main menu as transientParent
* the visualParent window() is used as transientParent, if exists

this partly fixes popup positioning in wayland, tough
the main taskbar menu is still mis positioned

Test Plan: submenus ok, taskbar contextmenus only partially fixed

Reviewers: #plasma, #plasma_on_wayland, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: davidedmundson, plasma-devel, #frameworks

Tags: #frameworks, #plasma_on_wayland

Differential Revision: https://phabricator.kde.org/D5773
2017-05-12 20:53:06 +02:00
Aleix Pol
328cd681a7 Update qmltypes 2017-04-10 16:02:23 +02:00
Aleix Pol
2df613f938 Generate plugins.qmltypes files for the plugins we install
Reviewers: #plasma, #frameworks, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: davidedmundson, hein, plasma-devel

Tags: #plasma, #frameworks

Differential Revision: https://phabricator.kde.org/D5088
2017-04-10 15:09:57 +02:00
Kai Uwe Broulik
edb05ef989 [ModelContextMenu] Silence warnings
When using a regular JavaScript Array as model and omitting certain roles (e.g. not
having a "text" for a separator) it would throw a warning.

Differential Revision: https://phabricator.kde.org/D5247
2017-03-30 15:03:39 +02:00
Kai Uwe Broulik
8d42e0072f [ModelContextMenu] Use Instantiator instead of Repeater-and-reparent-hack
Differential Revision: https://phabricator.kde.org/D5215
2017-03-29 12:11:02 +02:00
Roman Gilg
28ad7879d3 [Menu] Harmonize openRelative placement
Use the enums in a consistent way to place the menu around the parent item.

Test Plan:
Tested with plasma-pa and task manager context menu.

Reviewers: #plasma, hein

Reviewed By: #plasma, hein

Subscribers: plasma-devel, #frameworks

Tags: #plasma, #frameworks

Differential Revision: https://phabricator.kde.org/D4921
2017-03-22 11:16:33 +01:00
Kai Uwe Broulik
ff78b9e531 Add KAcceleratorManager
This way containment context menus and PlasmaComponents Menu get accelerators assigned to by default.

CHANGELOG: Most (context) menus have accelerators (Alt+letter shortcuts) now

BUG: 361915

Differential Revision: https://phabricator.kde.org/D5057
2017-03-16 11:47:59 +01:00
Roman Gilg
daee27f096 [Menu] Improve available space correction for openRelative
There was already some kind of detection and adjustment if there is not enough
space for the popup available. Do some more work by placing the popup according
to its PopupPlacement enum. Do this also if the popup breaks the top or left
boundary of the screen.

Also fixes some minor problems:

* TopPosedRightAlignedPopup was the same as RightPosedTopAlignedPopup, but in
  the first case the menu should be on top of parentItem
* LeftPosedTopAlignedPopup was above parentItem and not left of it
* Small documentation error

Reviewers: #plasma, hein

Subscribers: plasma-devel, #frameworks

Tags: #frameworks, #plasma

Differential Revision: https://phabricator.kde.org/D4867
2017-03-02 21:02:32 +01:00
David Edmundson
07d8df77a1 Connect all connections to action in QMenuItem::setAction
Summary:
Otherwise if anyone used setAction it would be missing a very important
connect.

Test Plan: Compiled

Reviewers: #plasma

Subscribers: plasma-devel, #frameworks

Tags: #plasma, #frameworks

Differential Revision: https://phabricator.kde.org/D4758
2017-02-24 14:16:51 +00:00
Eike Hein
701771833e Align bottom edge to top edge of visualParent in the TopPosedLeftAlignedPopup case.
Differential Revision: https://phabricator.kde.org/D4546
2017-02-11 00:35:37 +09:00
Kai Uwe Broulik
ceeb57d17f [PlasmaComponents Menu] Add maximumWidth property
This allows to limit the maximum width of a menu. It can be useful for instance
in task manager where long file names for recent documents will result in gigantic menus.

The property has a RESET method (which is called if you assign "undefined") which will
set it back to QWIDGETSIZE_MAX to remove the size restriction.

Differential Revision: https://phabricator.kde.org/D4257
2017-01-25 18:02:33 +01:00
Aleix Pol
54e87fe879 Make sure we display enabled ListItem on hover
Summary:
I just realized there was a weird workaround in plasma-nm where it gets
checked so it's shown.
Properly use the declarative API instead of listening to a ton of signals.

Test Plan: Tested with plasma-nm and org.kde.plasma.notifications plasmoids

Reviewers: #plasma, mart

Reviewed By: mart

Subscribers: mart, davidedmundson, plasma-devel, #frameworks

Tags: #plasma, #frameworks

Differential Revision: https://phabricator.kde.org/D4214
2017-01-24 15:47:07 +01:00
David Edmundson
17830b10f8 Remove excessive debug in CommonDialog 2017-01-19 02:29:57 +00:00
Marco Martin
859dcc1403 use PlasmaCore.ColorScope for text as the rest 2017-01-18 15:04:08 +01:00
Kevin Funk
f8a7b418d5 Prefer nullptr over Q_NULLPTR 2017-01-16 18:17:34 +01:00
Albert Astals Cid
5c46e32993 Q_ENUMS -> Q_ENUM and Q_FLAGS -> Q_FLAG
REVIEW: 129826
2017-01-14 01:06:28 +01:00
Marco Martin
12a4709b6c portait prop is not relevant when there is no text
this fixes a binding loop on this property
when there is no label

BUG:374815
Change-Id: I71616a6c86cd4acdaff47f141ed5c676358db496
2017-01-09 16:29:32 +01:00
Bhushan Shah
780be6f4ce Fix the renderType properties for various components
To use isMobile one need to import the QtQuickControls as well in
addition to QtQuickControls.Private

This fixes the warning flood at runtime

CCMAIL: faure@kde.org

I think p-f 5.30.0 tars need to be re-done with this.
2017-01-09 14:50:06 +05:30
Bhushan Shah
324232a745 [declarativeimports] Use QtRendering on phone devices
Summary: Ref T4947

Test Plan: works on desktop at least, haven't tested on phone yet

Reviewers: #plasma, mart

Reviewed By: mart

Subscribers: plasma-devel

Tags: #plasma

Maniphest Tasks: T4947

Differential Revision: https://phabricator.kde.org/D3789
2016-12-23 16:37:16 +05:30
Kai Uwe Broulik
a7ccca25ba [TextField] Allow disabling reveal password button through KIOSK restriction
This introduces a new lineedit_reveal_password restriction (similar to lineedit_text_completion)
that disables the reveal password button on Plasma text fields, like the lock screen and WiFi password inputs.

Differential Revision: https://phabricator.kde.org/D3654
2016-12-19 14:20:33 +01:00
Eike Hein
db15022686 Fix logic for arrow handling in RTL locales.
Summary: BUG:373749

Reviewers: #plasma, mart

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D3718
2016-12-18 08:32:27 +09:00
Marco Martin
783f26e628 don't flip tabbar layout if vertical
when the tabbar is vertical, on rtl layout the tabs order should
stay as is, as is rtl, not bottom-to-top

Change-Id: Ia5f1722d5e327207cf584a997dc8073c595c905b
REVIEW:129521
2016-11-21 17:27:17 +01:00
David Faure
a940089a8f Fix crash when no QApplication is available.
This happens when QtCreator launches qmlplugindump.
Testcase: qmlplugindump -nonrelocatable org.kde.analitza 1.1
or qmlplugindump -nonrelocatable org.kde.okular 2.0

REVIEW: 128767
2016-10-30 12:31:25 +01:00
Eike Hein
91eb0749ed Revert "port all output to QCDebug/QCWarning"
This reverts commit acd7ab7815.

This broke the build for me and on CI:
/home/jenkins/sources/plasma-framework/kf5-qt5/src/declarativeimports/core/datamodel.cpp:214:9:
error: 'LOG_PLASMACORE' was not declared in this scope

CCMAIL:notmart@gmail.com
2016-10-19 03:16:16 +09:00
Marco Martin
acd7ab7815 port all output to QCDebug/QCWarning
port every terminal output to appropriate QCdebug/QCwarning,
each different binary has its own logging category now, so
it's possible to enable/disable them selectively.
this should also make plasmashell a bit more quiet on
terminal by default

Change-Id: Ic0b26364f988935e990c6988f8f9375b7c9bf838
REVIEW:129210
2016-10-17 18:18:04 +02:00
David Rosca
1369bca36f Add removeMenuItem to PlasmaComponents.ContextMenu
REVIEW: 128999
2016-09-26 17:54:45 +02:00
Kai Uwe Broulik
3f17e32a92 [PlasmaComponents TextField] Don't bother loading icons for unused buttons
We kept loading the clear button and reveal password icons even when that option was
disabled and the buttons never visible.

REVIEW: 128753
2016-08-25 22:59:46 +02:00
David Edmundson
98cfdf6b45 Don't redeclare property implicitHeight 2016-08-18 12:06:20 +01:00
David Edmundson
cb9ec94625 Add an optional reveal password button to TextField
Similar to KPasswordWidget in kwidgetaddons

Also fixes:
- the clear button still being clickable when not enabled
- RTL icons
- Updating the right margin correctly

REVIEW: 128660
2016-08-15 14:34:15 +01:00
Kai Uwe Broulik
42193ae631 [TextField] Bind to TextField length instead of text
Copying strings in QML is expensive.

REVIEW: 128550
2016-07-29 15:41:40 +02:00
Eike Hein
1706b75272 Less debug noise. 2016-06-13 18:38:50 +09:00
David Edmundson
f5ad210742 Fix check to keep QMenu on screen for multiscreen layouts
If x > screenWidth should be if x > screenLeft + screenWidth

otherwise all right hand screens get offset

REVIEW: 128148
2016-06-10 11:57:32 +01:00
Eike Hein
9bd7e4ce5f Add a prop and method for aligning the menu against a corner of its visual parent.
REVIEW:127646
2016-04-14 22:10:24 +09:00
Eike Hein
17cea8059e Allow setting minimum width on Menu.
REVIEW:127648
2016-04-14 04:21:41 +09:00
Eike Hein
ec16c57e3c Maintain order in stored item list.
Reviewed-by: notmart@gmail.com
2016-04-14 01:38:12 +09:00