@@ -1106,8 +1106,7 @@ Page {
1106
1106
1107
1107
property var importHistory: undefined
1108
1108
1109
- onAboutToShow: {
1110
- swipeDialog .currentIndex = 0 ;
1109
+ function reloadHistory () {
1111
1110
if (webdavConnectionLoader .item ) {
1112
1111
importHistory = webdavConnectionLoader .item .importHistory ();
1113
1112
importWebdavUrlInput .model = [" " ].concat (Object .keys (importHistory[" urls" ]));
@@ -1125,34 +1124,43 @@ Page {
1125
1124
}
1126
1125
}
1127
1126
1127
+ onAboutToShow: {
1128
+ swipeDialog .currentIndex = 0 ;
1129
+ reloadHistory ();
1130
+ }
1131
+
1132
+ TextMetrics {
1133
+ id: importWebdavUrlLabelMetrics
1134
+ font: importWebdavUrlLabel .font
1135
+ text: importWebdavUrlLabel .text
1136
+ }
1137
+
1128
1138
SwipeView {
1129
1139
id: swipeDialog
1130
1140
width: mainWindow .width - 60 < importWebdavUrlLabelMetrics .width ? mainWindow .width - 60 : importWebdavUrlLabelMetrics .width
1131
1141
clip: true
1142
+ interactive: false
1132
1143
1133
- Column {
1144
+ GridLayout {
1134
1145
id: firstPage
1135
- width: childrenRect .width
1136
- height: childrenRect .height
1137
- spacing: 10
1138
-
1139
- TextMetrics {
1140
- id: importWebdavUrlLabelMetrics
1141
- font: importWebdavUrlLabel .font
1142
- text: importWebdavUrlLabel .text
1143
- }
1146
+ width: swipeDialog .width
1147
+ rowSpacing: 10
1148
+ columnSpacing: 5
1149
+ columns: 2
1144
1150
1145
1151
Label {
1146
1152
id: importWebdavUrlLabel
1147
- width: mainWindow .width - 60 < importWebdavUrlLabelMetrics .width ? mainWindow .width - 60 : importWebdavUrlLabelMetrics .width
1153
+ Layout .fillWidth : true
1154
+ Layout .columnSpan : 2
1148
1155
text: qsTr (" Type the WebDAV details below to import a remote folder:" )
1149
1156
wrapMode: Text .WordWrap
1150
1157
font: Theme .defaultFont
1151
1158
color: Theme .mainTextColor
1152
1159
}
1153
1160
1154
1161
Label {
1155
- width: importWebdavUrlLabel .width
1162
+ Layout .fillWidth : true
1163
+ Layout .columnSpan : 2
1156
1164
text: qsTr (" WebDAV server URL" )
1157
1165
wrapMode: Text .WordWrap
1158
1166
font: Theme .defaultFont
@@ -1161,8 +1169,8 @@ Page {
1161
1169
1162
1170
ComboBox {
1163
1171
id: importWebdavUrlInput
1172
+ Layout .fillWidth : true
1164
1173
enabled: ! webdavConnectionLoader .item || ! webdavConnectionLoader .item .isFetchingAvailablePaths
1165
- width: importWebdavUrlLabel .width
1166
1174
editable: true
1167
1175
1168
1176
Connections {
@@ -1183,8 +1191,24 @@ Page {
1183
1191
}
1184
1192
}
1185
1193
1194
+ QfToolButton {
1195
+ bgcolor: " transparent"
1196
+ iconSource: Theme .getThemeVectorIcon (' ic_delete_forever_white_24dp' )
1197
+ iconColor: enabled ? Theme .mainTextColor : Theme .mainTextDisabledColor
1198
+ enabled: importWebdavUrlInput .editText !== " "
1199
+
1200
+ onClicked: {
1201
+ if (webdavConnectionLoader .item ) {
1202
+ webdavForgetConfirmationDialog .url = importWebdavUrlInput .editText ;
1203
+ webdavForgetConfirmationDialog .username = " " ;
1204
+ webdavForgetConfirmationDialog .open ();
1205
+ }
1206
+ }
1207
+ }
1208
+
1186
1209
Label {
1187
- width: importWebdavUrlLabel .width
1210
+ Layout .fillWidth : true
1211
+ Layout .columnSpan : 2
1188
1212
text: qsTr (" User and password" )
1189
1213
wrapMode: Text .WordWrap
1190
1214
font: Theme .defaultFont
@@ -1194,7 +1218,7 @@ Page {
1194
1218
ComboBox {
1195
1219
id: importWebdavUserInput
1196
1220
enabled: ! webdavConnectionLoader .item || ! webdavConnectionLoader .item .isFetchingAvailablePaths
1197
- width : importWebdavUrlLabel . width
1221
+ Layout . fillWidth : true
1198
1222
editable: true
1199
1223
1200
1224
Connections {
@@ -1209,10 +1233,25 @@ Page {
1209
1233
}
1210
1234
}
1211
1235
1236
+ QfToolButton {
1237
+ bgcolor: " transparent"
1238
+ iconSource: Theme .getThemeVectorIcon (' ic_delete_forever_white_24dp' )
1239
+ iconColor: enabled ? Theme .mainTextColor : Theme .mainTextDisabledColor
1240
+ enabled: importWebdavUrlInput .editText !== " " && importWebdavUserInput .editText !== " "
1241
+
1242
+ onClicked: {
1243
+ if (webdavConnectionLoader .item ) {
1244
+ webdavForgetConfirmationDialog .url = importWebdavUrlInput .editText ;
1245
+ webdavForgetConfirmationDialog .username = importWebdavUserInput .editText ;
1246
+ webdavForgetConfirmationDialog .open ();
1247
+ }
1248
+ }
1249
+ }
1250
+
1212
1251
TextField {
1213
1252
id: importWebdavPasswordInput
1214
1253
enabled: ! webdavConnectionLoader .item || ! webdavConnectionLoader .item .isFetchingAvailablePaths
1215
- width : importWebdavUrlLabel . width
1254
+ Layout . fillWidth : true
1216
1255
rightPadding: leftPadding + (importWebdavShowPasswordInput .width - leftPadding)
1217
1256
placeholderText: text === " " && webdavConnectionLoader .item && webdavConnectionLoader .item .isPasswordStored ? qsTr (" leave empty to use remembered" ) : " "
1218
1257
echoMode: TextInput .Password
@@ -1247,40 +1286,44 @@ Page {
1247
1286
}
1248
1287
}
1249
1288
1289
+ Item {
1290
+ }
1291
+
1250
1292
CheckBox {
1251
1293
id: importWebdavStorePasswordCheck
1252
- width: importWebdavUrlLabel .width
1294
+ Layout .fillWidth : true
1295
+ Layout .columnSpan : 2
1253
1296
enabled: ! webdavConnectionLoader .item || ! webdavConnectionLoader .item .isFetchingAvailablePaths
1254
1297
text: qsTr (' Remember password' )
1255
1298
font: Theme .defaultFont
1256
1299
checked: true
1257
1300
}
1258
1301
1259
- Row {
1260
- QfButton {
1261
- id: importWebdavFetchFoldersButton
1262
- anchors .verticalCenter : importWebdavFetchFoldersIndicator .verticalCenter
1263
- enabled: ! webdavConnectionLoader .item || ! webdavConnectionLoader .item .isFetchingAvailablePaths
1264
- width: importWebdavUrlLabel .width - (importWebdavFetchFoldersIndicator .visible ? importWebdavFetchFoldersIndicator .width : 0 )
1265
- text: ! enabled ? qsTr (" Fetching remote folders" ) : qsTr (" Fetch remote folders" )
1302
+ QfButton {
1303
+ id: importWebdavFetchFoldersButton
1304
+ Layout .fillWidth : true
1305
+ Layout .columnSpan : importWebdavFetchFoldersIndicator .visible ? 1 : 2
1306
+ enabled: ! webdavConnectionLoader .item || ! webdavConnectionLoader .item .isFetchingAvailablePaths
1307
+ text: ! enabled ? qsTr (" Fetching remote folders" ) : qsTr (" Fetch remote folders" )
1266
1308
1267
- onClicked: {
1268
- webdavConnectionLoader .item .fetchAvailablePaths ();
1269
- }
1309
+ onClicked: {
1310
+ webdavConnectionLoader .item .fetchAvailablePaths ();
1270
1311
}
1312
+ }
1271
1313
1272
- BusyIndicator {
1273
- id: importWebdavFetchFoldersIndicator
1274
- anchors .verticalCenter : importWebdavFetchFoldersButton .verticalCenter
1275
- width: 48
1276
- height: 48
1277
- visible: webdavConnectionLoader .item && webdavConnectionLoader .item .isFetchingAvailablePaths
1278
- running: visible
1279
- }
1314
+ BusyIndicator {
1315
+ id: importWebdavFetchFoldersIndicator
1316
+ Layout .preferredWidth : 48
1317
+ Layout .preferredHeight : 48
1318
+ visible: webdavConnectionLoader .item && webdavConnectionLoader .item .isFetchingAvailablePaths
1319
+ running: visible
1280
1320
}
1281
1321
}
1282
1322
1283
1323
Column {
1324
+ width: swipeDialog .width
1325
+ spacing: 10
1326
+
1284
1327
Label {
1285
1328
width: importWebdavUrlLabel .width
1286
1329
visible: importWebdavPathInput .visible
@@ -1450,6 +1493,8 @@ Page {
1450
1493
width: importWebdavUrlLabel .width - (importWebdavRefreshFoldersIndicator .visible ? importWebdavRefreshFoldersIndicator .width : 0 )
1451
1494
enabled: ! webdavConnectionLoader .item || ! webdavConnectionLoader .item .isFetchingAvailablePaths
1452
1495
bgcolor: " transparent"
1496
+ borderColor: enabled ? Theme .secondaryTextColor : Theme .mainTextDisabledColor
1497
+ color: enabled ? Theme .mainTextColor : Theme .mainTextDisabledColor
1453
1498
text: ! enabled ? qsTr (" Refreshing remote folders" ) : qsTr (" Refresh remote folders" )
1454
1499
1455
1500
onClicked: {
@@ -1481,6 +1526,49 @@ Page {
1481
1526
}
1482
1527
}
1483
1528
1529
+ QfDialog {
1530
+ id: webdavForgetConfirmationDialog
1531
+ title: qsTr (" Confirm" )
1532
+ focus: visible
1533
+ parent: mainWindow .contentItem
1534
+
1535
+ property string url: " "
1536
+ property string username: " "
1537
+
1538
+ Column {
1539
+ width: childrenRect .width
1540
+ height: childrenRect .height
1541
+ spacing: 10
1542
+
1543
+ TextMetrics {
1544
+ id: webdavForgetConfirmationMetrics
1545
+ font: webdavForgetConfirmationLabel .font
1546
+ text: webdavForgetConfirmationLabel .text
1547
+ }
1548
+
1549
+ Label {
1550
+ id: webdavForgetConfirmationLabel
1551
+ width: mainWindow .width - 60 < webdavForgetConfirmationMetrics .width ? mainWindow .width - 60 : webdavForgetConfirmationMetrics .width
1552
+ text: qsTr (" You are about to remove a saved WebDAV item, proceed?" )
1553
+ wrapMode: Text .WordWrap
1554
+ font: Theme .defaultFont
1555
+ color: Theme .mainTextColor
1556
+ }
1557
+ }
1558
+
1559
+ onAccepted: {
1560
+ if (webdavForgetConfirmationDialog .username != " " ) {
1561
+ webdavConnectionLoader .item .forgetHistory (webdavForgetConfirmationDialog .url , webdavForgetConfirmationDialog .username );
1562
+ } else {
1563
+ webdavConnectionLoader .item .forgetHistory (webdavForgetConfirmationDialog .url );
1564
+ }
1565
+ importWebdavUrlInput .currentIndex = 0 ;
1566
+ importWebdavUserInput .currentIndex = 0 ;
1567
+ importWebdavPasswordInput .text = ' ' ;
1568
+ importWebdavDialog .reloadHistory ();
1569
+ }
1570
+ }
1571
+
1484
1572
Connections {
1485
1573
target: iface
1486
1574
0 commit comments