Changeset View
Changeset View
Standalone View
Standalone View
containments/desktop/package/contents/ui/FolderView.qml
Show First 20 Lines • Show All 1138 Lines • ▼ Show 20 Line(s) | 1070 | PlasmaComponents.TextArea { | |||
---|---|---|---|---|---|
1139 | 1139 | | |||
1140 | function getXY() { | 1140 | function getXY() { | ||
1141 | var pos = main.mapFromItem(targetItem, targetItem.labelArea.x, targetItem.labelArea.y); | 1141 | var pos = main.mapFromItem(targetItem, targetItem.labelArea.x, targetItem.labelArea.y); | ||
1142 | var _x, _y; | 1142 | var _x, _y; | ||
1143 | if(isPopup) { | 1143 | if(isPopup) { | ||
1144 | _x = targetItem.labelArea.x - __style.padding.left; | 1144 | _x = targetItem.labelArea.x - __style.padding.left; | ||
1145 | _y = pos.y - __style.padding.top; | 1145 | _y = pos.y - __style.padding.top; | ||
1146 | } else { | 1146 | } else { | ||
1147 | _x = targetItem.x + units.largeSpacing + units.smallSpacing - __style.padding.left; | 1147 | _x = targetItem.x + Math.abs(Math.min(gridView.contentX, gridView.originX)); | ||
1148 | _x += (targetItem.width/2 - targetItem.label.paintedWidth/2 - __style.padding.left); | ||||
1149 | _x += scrollArea.viewport.x; | ||||
1150 | | ||||
1151 | if (verticalScrollBarPolicy == Qt.ScrollBarAlwaysOn | ||||
1152 | && gridView.effectiveLayoutDirection == Qt.RightToLeft) { | ||||
1153 | _x -= __verticalScrollBar.parent.verticalScrollbarOffset; | ||||
1154 | } | ||||
1155 | | ||||
1148 | _y = pos.y + units.smallSpacing - __style.padding.top; | 1156 | _y = pos.y + units.smallSpacing - __style.padding.top; | ||
1149 | } | 1157 | } | ||
1150 | return([ _x, _y ]); | 1158 | return([ _x, _y ]); | ||
1151 | } | 1159 | } | ||
1152 | 1160 | | |||
1153 | function getWidth(addWidthVerticalScroller) { | 1161 | function getWidth(addWidthVerticalScroller) { | ||
1154 | return(targetItem.width - units.largeSpacing * 2 - (isPopup ? 0 : units.smallSpacing * 2) + __style.padding.left + __style.padding.right + | 1162 | var _width = isPopup ? targetItem.width - units.largeSpacing * 2 : targetItem.label.paintedWidth; | ||
1155 | (addWidthVerticalScroller ? __verticalScrollBar.parent.verticalScrollbarOffset : 0)); | 1163 | return _width + __style.padding.left + __style.padding.right + | ||
1164 | (addWidthVerticalScroller ? __verticalScrollBar.parent.verticalScrollbarOffset : 0); | ||||
1156 | } | 1165 | } | ||
1157 | 1166 | | |||
1158 | function getHeight(addWidthHoriozontalScroller, init) { | 1167 | function getHeight(addWidthHoriozontalScroller, init) { | ||
1159 | var _height; | 1168 | var _height; | ||
1160 | if(isPopup || init) { | 1169 | if(isPopup || init) { | ||
1161 | _height = targetItem.labelArea.height + __style.padding.top + __style.padding.bottom; | 1170 | _height = targetItem.labelArea.height + __style.padding.top + __style.padding.bottom; | ||
1162 | } else { | 1171 | } else { | ||
1163 | var realHeight = contentHeight + __style.padding.top + __style.padding.bottom; | 1172 | var realHeight = contentHeight + __style.padding.top + __style.padding.bottom; | ||
Show All 23 Lines | 1195 | if(contentHeight + __style.padding.top + __style.padding.bottom > height) { | |||
1187 | visible = true; | 1196 | visible = true; | ||
1188 | verticalScrollBarPolicy = Qt.ScrollBarAlwaysOn; | 1197 | verticalScrollBarPolicy = Qt.ScrollBarAlwaysOn; | ||
1189 | width = getWidth(true); | 1198 | width = getWidth(true); | ||
1190 | } else { | 1199 | } else { | ||
1191 | verticalScrollBarPolicy = Qt.ScrollBarAlwaysOff; | 1200 | verticalScrollBarPolicy = Qt.ScrollBarAlwaysOff; | ||
1192 | width = getWidth(); | 1201 | width = getWidth(); | ||
1193 | } | 1202 | } | ||
1194 | } | 1203 | } | ||
1204 | | ||||
1205 | var xy = getXY(); | ||||
1206 | x = xy[0]; | ||||
1207 | y = xy[1]; | ||||
1195 | } | 1208 | } | ||
1196 | 1209 | | |||
1197 | } | 1210 | } | ||
1198 | 1211 | | |||
1199 | Component.onCompleted: { | 1212 | Component.onCompleted: { | ||
1200 | dir.requestRename.connect(rename); | 1213 | dir.requestRename.connect(rename); | ||
1201 | } | 1214 | } | ||
1202 | } | 1215 | } | ||
1203 | 1216 | | |||
1204 | Component.onCompleted: { | 1217 | Component.onCompleted: { | ||
1205 | if (backButton == null && root.useListViewMode) { | 1218 | if (backButton == null && root.useListViewMode) { | ||
1206 | backButton = makeBackButton(); | 1219 | backButton = makeBackButton(); | ||
1207 | } | 1220 | } | ||
1208 | } | 1221 | } | ||
1209 | } | 1222 | } |