Commit f55b00fe authored by Nate Graham's avatar Nate Graham 💤
Browse files

Begin porting to PlasmaComponents3

This begins the process of porting plasma-workspace to PlasmaComponents3. At
this point, only the relatively easy work is done. Every file not ported
now has been given the reason for still using PC2 in a comment on the import
line so you can see at a glance what the blocker is by running
`grep -r "org.kde.plasma.components 2.0"` in the repo.

Everything is tested and there are no breakages or functional regressions. In
the process, a few unused imports are removed.

Here are the remaining PC3 omissions blocking what's left from getting easily
ported:
- No Highlight
- No ListItem
- No PageStack
- No ContextMenu
- No QueryDialog
- No ModelContextMenu
- TabBar has no left and right tab states
- ToolButton has no built-in method to show a menu when clicked
parent 7f52a95b
......@@ -20,7 +20,7 @@ import QtQuick 2.0
import QtQuick.Layouts 1.1
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.components 2.0 as PlasmaComponents // PC3 Tabbar only has top and bottom tab positions, not left and right
import org.kde.activities 0.1 as Activities
Item {
......
......@@ -23,7 +23,7 @@ import QtQuick.Controls 2.8
import org.kde.plasma.plasmoid 2.0
import org.kde.kquickcontrolsaddons 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.plasma.private.appmenu 1.0 as AppMenuPrivate
Item {
......@@ -41,7 +41,7 @@ Item {
Plasmoid.preferredRepresentation: (plasmoid.configuration.compactView || vertical) ? Plasmoid.compactRepresentation : Plasmoid.fullRepresentation
Plasmoid.compactRepresentation: PlasmaComponents.ToolButton {
Plasmoid.compactRepresentation: PlasmaComponents3.ToolButton {
readonly property int fakeIndex: 0
Layout.fillWidth: false
Layout.fillHeight: false
......@@ -50,7 +50,7 @@ Item {
enabled: menuAvailable
checkable: menuAvailable && plasmoid.nativeInterface.currentIndex === fakeIndex
checked: checkable
iconSource: "application-menu"
icon.name: "application-menu"
onClicked: plasmoid.nativeInterface.trigger(this, 0);
}
......@@ -100,7 +100,7 @@ Item {
connectedSources: ["Alt"]
}
PlasmaComponents.ToolButton {
PlasmaComponents3.ToolButton {
id: noMenuPlaceholder
visible: buttonRepeater.count == 0
text: plasmoid.title
......@@ -113,7 +113,7 @@ Item {
id: buttonRepeater
model: appMenuModel.visible ? appMenuModel : null
PlasmaComponents.ToolButton {
PlasmaComponents3.ToolButton {
readonly property int buttonIndex: index
Layout.preferredWidth: minimumWidth
......
......@@ -21,7 +21,7 @@ import QtQuick.Layouts 1.1
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.plasma.calendar 2.0
......@@ -59,12 +59,11 @@ Item {
anchors.fill: parent
source: Qt.resolvedUrl("../images/mini-calendar.svgz")
PlasmaComponents.Label {
PlasmaComponents3.Label {
anchors {
fill: parent
margins: Math.round(parent.width * 0.1)
}
height: undefined
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.pixelSize: 1000
......
......@@ -19,7 +19,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import QtQuick.Layouts 1.1
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.components 2.0 as PlasmaComponents // For ContextMenu
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.kquickcontrolsaddons 2.0
import org.kde.plasma.extras 2.0 as PlasmaExtras
......@@ -33,9 +34,9 @@ ColumnLayout {
property var header: PlasmaExtras.PlasmoidHeading {
RowLayout {
anchors.fill: parent
PlasmaComponents.Button {
PlasmaComponents3.Button {
Layout.fillWidth: true
iconSource: "go-previous-view"
icon.name: "go-previous-view"
text: i18n("Return to Clipboard")
onClicked: stack.pop()
}
......@@ -78,12 +79,15 @@ ColumnLayout {
});
}
}
PlasmaComponents.ToolButton {
PlasmaComponents3.ToolButton {
id: configureButton
checkable: true
iconSource: "configure"
tooltip: i18n("Change the barcode type")
icon.name: "configure"
onClicked: menu.openRelative()
PlasmaComponents3.ToolTip {
text: i18n("Change the barcode type")
}
}
}
}
......@@ -102,7 +106,7 @@ ColumnLayout {
opacity: valid ? 1 : 0
}
PlasmaComponents.Label {
PlasmaComponents3.Label {
anchors.fill: parent
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
......@@ -111,7 +115,7 @@ ColumnLayout {
visible: barcodeItem.implicitWidth === 0 && barcodeItem.implicitHeight === 0
}
PlasmaComponents.Label {
PlasmaComponents3.Label {
anchors.fill: parent
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
......
......@@ -21,7 +21,7 @@ import QtQuick 2.0
import QtQuick.Layouts 1.1
import QtGraphicalEffects 1.0
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.components 2.0 as PlasmaComponents // For ListItem
import org.kde.kquickcontrolsaddons 2.0 as KQuickControlsAddons
PlasmaComponents.ListItem {
......
......@@ -22,7 +22,7 @@ import QtQuick.Layouts 1.1
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.plasma.extras 2.0 as PlasmaExtras
ColumnLayout {
......@@ -81,16 +81,19 @@ ColumnLayout {
anchors.fill: parent
enabled: clipboardMenu.model.count > 0
PlasmaComponents.TextField {
PlasmaComponents3.TextField {
id: filter
placeholderText: i18n("Search...")
clearButtonShown: true
Layout.fillWidth: true
}
PlasmaComponents.ToolButton {
iconSource: "edit-clear-history"
tooltip: i18n("Clear history")
PlasmaComponents3.ToolButton {
icon.name: "edit-clear-history"
onClicked: clipboardSource.service("", "clearHistory")
PlasmaComponents3.ToolTip {
text: i18n("Clear history")
}
}
}
}
......
......@@ -20,35 +20,47 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.components 3.0 as PlasmaComponents3
Row {
id: toolButtonsLayout
visible: menuItem.ListView.isCurrentItem
PlasmaComponents.ToolButton {
PlasmaComponents3.ToolButton {
// TODO: only show for items supporting actions?
iconSource: "system-run"
tooltip: i18n("Invoke action")
icon.name: "system-run"
onClicked: menuItem.action(UuidRole)
PlasmaComponents3.ToolTip {
text: i18n("Invoke action")
}
}
PlasmaComponents.ToolButton {
PlasmaComponents3.ToolButton {
id: barcodeToolButton
iconSource: "view-barcode-qr"
tooltip: i18n("Show barcode")
icon.name: "view-barcode-qr"
visible: supportsBarcodes
onClicked: menuItem.barcode(DisplayRole)
PlasmaComponents3.ToolTip {
text: i18n("Show barcode")
}
}
PlasmaComponents.ToolButton {
iconSource: "document-edit"
PlasmaComponents3.ToolButton {
icon.name: "document-edit"
enabled: !clipboardSource.editing
visible: TypeRole === 0
tooltip: i18n("Edit contents")
onClicked: menuItem.edit(UuidRole)
PlasmaComponents3.ToolTip {
text: i18n("Edit contents")
}
}
PlasmaComponents.ToolButton {
iconSource: "edit-delete"
tooltip: i18n("Remove from history")
PlasmaComponents3.ToolButton {
icon.name: "edit-delete"
onClicked: menuItem.remove(UuidRole)
PlasmaComponents3.ToolTip {
text: i18n("Remove from history")
}
}
}
......@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
import QtQuick 2.0
import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.components 2.0 as PlasmaComponents // For Highlight
import org.kde.kirigami 2.12 as Kirigami
......
......@@ -20,10 +20,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.components 3.0 as PlasmaComponents3
PlasmaComponents.Label {
height: undefined // unset PlasmaComponents.Label default height
PlasmaComponents3.Label {
maximumLineCount: 3
verticalAlignment: Text.AlignVCenter
......
......@@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.kquickcontrolsaddons 2.0 as KQuickControlsAddons
Item {
......@@ -84,7 +84,7 @@ Item {
bottom: parent.bottom
}
}
PlasmaComponents.Label {
PlasmaComponents3.Label {
font: theme.smallestFont
color: theme.backgroundColor
maximumLineCount: 1
......@@ -104,7 +104,7 @@ Item {
}
}
}
PlasmaComponents.Label {
PlasmaComponents3.Label {
property int additionalItems: DisplayRole.split(" ").length - maximumNumberOfPreviews
visible: additionalItems > 0
opacity: 0.6
......
......@@ -21,7 +21,7 @@ import QtQuick 2.0
import QtQuick.Layouts 1.1
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.components 2.0 as PlasmaComponents // For PageStack
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.plasma.extras 2.0 as PlasmaExtras
......
......@@ -27,7 +27,8 @@ import QtQuick.Window 2.2
import QtQuick.Layouts 1.1
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.components 2.0 as PlasmaComponents // For Highlight
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.plasma.extras 2.0 as PlasmaExtras
MouseArea {
......@@ -117,14 +118,17 @@ MouseArea {
Item {
anchors.fill: parent
PlasmaComponents.ToolButton {
PlasmaComponents3.ToolButton {
id: unmountAll
visible: devicenotifier.mountedRemovables > 1;
anchors.right: parent.right
iconSource: "media-eject"
tooltip: i18n("Click to safely remove all devices")
icon.name: "media-eject"
text: i18n("Remove all")
implicitWidth: minimumWidth
PlasmaComponents3.ToolTip {
text: i18n("Click to safely remove all devices")
}
}
PlasmaExtras.ScrollArea {
......
......@@ -19,7 +19,7 @@ import QtQuick 2.4
import QtQuick.Layouts 1.1
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.calendar 2.0 as PlasmaCalendar
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.components 2.0 as PlasmaComponents // For ListItem
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.plasma.extras 2.0 as PlasmaExtras
......@@ -312,7 +312,7 @@ PlasmaComponents3.Page {
visible: modelData.eventColor !== ""
}
PlasmaComponents.Label {
PlasmaComponents3.Label {
id: startTimeLabel
readonly property bool startsToday: modelData.startDateTime - monthView.currentDate >= 0
......@@ -329,7 +329,7 @@ PlasmaComponents3.Page {
visible: eventItem.hasTime
}
PlasmaComponents.Label {
PlasmaComponents3.Label {
id: endTimeLabel
readonly property bool endsToday: modelData.endDateTime - monthView.currentDate <= 86400000 // 24hrs in ms
......@@ -348,7 +348,7 @@ PlasmaComponents3.Page {
visible: eventItem.hasTime
}
PlasmaComponents.Label {
PlasmaComponents3.Label {
id: eventTitle
readonly property bool wrap: eventDescription.text === ""
......@@ -365,7 +365,7 @@ PlasmaComponents3.Page {
wrapMode: wrap ? Text.Wrap : Text.NoWrap
}
PlasmaComponents.Label {
PlasmaComponents3.Label {
id: eventDescription
opacity: 0.7
......
......@@ -21,7 +21,7 @@
import QtQuick 2.6
import QtQuick.Layouts 1.1
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as Components
import org.kde.plasma.components 2.0 as Components // Date label height breaks on vertical panel with PC3 version
import org.kde.plasma.private.digitalclock 1.0
Item {
......
......@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtQuick.Layouts 1.1
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.plasma.extras 2.0 as PlasmaExtras
Item {
......@@ -54,7 +54,7 @@ Item {
text: clocks.visible ? Qt.formatDate(tzDate, Locale.LongFormat) : Qt.formatDate(tzDate,"dddd")
}
PlasmaComponents.Label {
PlasmaComponents3.Label {
id: tooltipSubtext
Layout.minimumWidth: Math.min(implicitWidth, preferredTextWidth)
Layout.maximumWidth: preferredTextWidth
......@@ -88,7 +88,7 @@ Item {
return timezones;
}
PlasmaComponents.Label {
PlasmaComponents3.Label {
id: timezone
// Layout.fillWidth is buggy here
Layout.alignment: index % 2 === 0 ? Qt.AlignRight : Qt.AlignLeft
......@@ -96,7 +96,6 @@ Item {
wrapMode: Text.NoWrap
text: index % 2 == 0 ? nameForZone(modelData) : timeForZone(modelData)
font.weight: modelData === plasmoid.configuration.lastSelectedTimezone ? Font.Bold : Font.Normal
height: paintedHeight
elide: Text.ElideNone
opacity: 0.6
}
......
......@@ -19,7 +19,6 @@ import QtQuick 2.0
import QtQuick.Layouts 1.1
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.kquickcontrolsaddons 2.0
import org.kde.plasma.private.digitalclock 1.0
......
......@@ -25,7 +25,7 @@ import QtGraphicalEffects 1.0
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as Components
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.kquickcontrolsaddons 2.0
import org.kde.draganddrop 2.0 as DragDrop
......@@ -140,7 +140,7 @@ MouseArea {
source: constrained ? null : text
}
Components.Label {
PlasmaComponents3.Label {
id : text
text : plasmoid.title
anchors {
......@@ -148,7 +148,6 @@ MouseArea {
bottom : parent.bottom
right : parent.right
}
height: undefined // unset Label defaults
horizontalAlignment : Text.AlignHCenter
visible: false // rendered by DropShadow
maximumLineCount: 2
......
......@@ -21,7 +21,7 @@ import QtQuick 2.0
import QtQuick.Layouts 1.0
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0
import org.kde.plasma.components 2.0 as PlasmaComponents // For QueryDialog
import org.kde.kquickcontrolsaddons 2.0
import "data.js" as Data
......@@ -119,7 +119,7 @@ Flow {
Component {
id: hibernateDialogComponent
QueryDialog {
PlasmaComponents.QueryDialog {
titleIcon: "system-suspend-hibernate"
titleText: i18n("Hibernate")
message: i18n("Do you want to suspend to disk (hibernate)?")
......@@ -131,11 +131,11 @@ Flow {
onAccepted: performOperation("suspendToDisk")
}
}
property QueryDialog hibernateDialog
property PlasmaComponents.QueryDialog hibernateDialog
Component {
id: sleepDialogComponent
QueryDialog {
PlasmaComponents.QueryDialog {
titleIcon: "system-suspend"
titleText: i18nc("Suspend to RAM", "Sleep")
message: i18n("Do you want to suspend to RAM (sleep)?")
......@@ -147,7 +147,7 @@ Flow {
onAccepted: performOperation("suspendToRam")
}
}
property QueryDialog sleepDialog
property PlasmaComponents.QueryDialog sleepDialog
function clickHandler(what, button) {
if (what === "suspendToDisk") {
......
......@@ -23,7 +23,6 @@ import QtQuick 2.0
import QtQuick.Layouts 1.1
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.extras 2.0 as PlasmaExtras
Item {
......
......@@ -22,7 +22,7 @@ import QtQuick 2.8
import QtQuick.Layouts 1.1
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.quickcharts 1.0 as Charts
......@@ -93,7 +93,7 @@ MouseArea {
thickness: units.devicePixelRatio * 5
}
PlasmaComponents.Label {
PlasmaComponents3.Label {
id: countLabel
anchors.centerIn: parent
width: Math.round(Math.min(parent.width, parent.height) * (text.length > 1 ? 0.67 : 0.75))
......@@ -109,7 +109,7 @@ MouseArea {
visible: false
}
PlasmaComponents.BusyIndicator {
PlasmaComponents3.BusyIndicator {
id: busyIndicator
anchors.fill: parent
visible: false
......
Markdown is supported
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