@ -25,8 +25,10 @@ import org.kde.qtextracomponents 2.0
Item {
id: main
width: 400
height: 800
/ / t h i s i s u s e d t o p e r f e c t l y a l i g n t h e f i l t e r f i e l d a n d d e l e g a t e s
property int cellWidth: theme . defaultFont . mSize . width * 20
property int cellWidth: theme . defaultFont . pixelSize * 20
property int minimumWidth: cellWidth + (
widgetExplorer . orientation == Qt . Horizontal
@ -38,6 +40,12 @@ Item {
property Item getWidgetsButton
property Item categoryButton
function i18n ( inp ) { / / F I X M E : H A C K !
return inp ;
}
PlasmaComponents . ContextMenu {
id: categoriesDialog
visualParent: main . categoryButton
@ -45,22 +53,22 @@ Item {
Repeater {
parent: categoriesDialog
model: widgetExplorer . filterModel
delegate: PlasmaComponents . MenuItem {
text: displa y
separator: model [ "separator" ]
onClicked: {
list . contentX = 0
list . contentY = 0
var item = widgetExplorer . filterModel . get ( index )
widgetExplorer . widgetsModel . filterType = item . filterTyp e
widgetExplorer . widgetsModel . filterQuery = item . filterDat a
main . categoryButton . text = item . displa y
}
Component.onCompleted: {
parent = categoriesDialo g
}
}
/ / d e l e g a t e : P l a s m a C o m p o n e n t s . M e n u I t e m {
/ / t e x t : d i s p l a y
/ / s e p a r a t o r : m o d e l [ " s e p a r a t o r " ]
/ / o n C l i c k e d : {
/ / l i s t . c o n t e n t X = 0
/ / l i s t . c o n t e n t Y = 0
/ / v a r i t e m = w i d g e t E x p l o r e r . f i l t e r M o d e l . g e t ( i n d e x )
/ /
/ / w i d g e t E x p l o r e r . w i d g e t s M o d e l . f i l t e r T y p e = i t e m . f i l t e r T y p e
/ / w i d g e t E x p l o r e r . w i d g e t s M o d e l . f i l t e r Q u e r y = i t e m . f i l t e r D a t a
/ / m a i n . c a t e g o r y B u t t o n . t e x t = i t e m . d i s p l a y
/ / }
/ / C o m p o n e n t . o n C o m p l e t e d : {
/ / p a r e n t = c a t e g o r i e s D i a l o g
/ / }
/ / }
}
PlasmaComponents . ContextMenu {
@ -70,15 +78,15 @@ Item {
Repeater {
parent: getWidgetsDialog
model: widgetExplorer . widgetsMenuActions
delegate: PlasmaComponents . MenuItem {
icon: modelData . ico n
text: modelData . tex t
separator: modelData . separato r
onClicked: modelData . trigger ( )
Component.onCompleted: {
parent = getWidgetsDialo g
}
}
/ / d e l e g a t e : P l a s m a C o m p o n e n t s . M e n u I t e m {
/ / i c o n : m o d e l D a t a . i c o n
/ / t e x t : m o d e l D a t a . t e x t
/ / s e p a r a t o r : m o d e l D a t a . s e p a r a t o r
/ / o n C l i c k e d : m o d e l D a t a . t r i g g e r ( )
/ / C o m p o n e n t . o n C o m p l e t e d : {
/ / p a r e n t = g e t W i d g e t s D i a l o g
/ / }
/ / }
}
PlasmaCore . Dialog {
@ -283,7 +291,7 @@ Item {
id: list
property int delegateWidth: ( widgetExplorer . orientation == Qt . Horizontal ) ? ( list . width / Math . floor ( list . width / cellWidth ) ) : list . width
property int delegateHeight: theme . defaultFont . mSize . height * 7 - 4
property int delegateHeight: theme . defaultFont . pixelSize * 7 - 4
anchors.fill: parent
@ -313,7 +321,8 @@ Item {
id: bottomBar
sourceComponent: ( widgetExplorer . orientation == Qt . Horizontal ) ? undefined : verticalBottomBarComponent
height: item . height
/ / h e i g h t : i t e m . h e i g h t
height: 48 / / F I X M E
anchors {
left: parent . left
right: parent . right