54
54
#include < QToolTip>
55
55
#include < QTreeView>
56
56
57
+ #include < QtQuickWidgets/QtQuickWidgets>
58
+
57
59
58
60
namespace {
59
61
constexpr auto modalWidgetStretchedMarginC = 50 ;
@@ -64,6 +66,19 @@ namespace OCC {
64
66
Q_LOGGING_CATEGORY (lcAccountSettings, " gui.account.settings" , QtInfoMsg)
65
67
66
68
69
+ class NetworkAccessManagerFactory : public QQmlNetworkAccessManagerFactory
70
+ {
71
+ public:
72
+ NetworkAccessManagerFactory (Account *acc)
73
+ : _acc(acc)
74
+ {
75
+ }
76
+
77
+ inline QNetworkAccessManager *create (QObject *parent) override { return _acc->accessManager (); }
78
+
79
+ Account *_acc;
80
+ };
81
+
67
82
AccountSettings::AccountSettings (const AccountStatePtr &accountState, QWidget *parent)
68
83
: QWidget(parent)
69
84
, ui(new Ui::AccountSettings)
@@ -84,14 +99,31 @@ AccountSettings::AccountSettings(const AccountStatePtr &accountState, QWidget *p
84
99
85
100
_sortModel = weightedModel;
86
101
87
- ui->_folderList ->setModel (_sortModel);
102
+ const QUrl src = QUrl::fromLocalFile (QStringLiteral (" C:\\ CraftRoot\\ download\\ git\\ owncloud\\ owncloud-client\\ src\\ gui\\ qml\\ tree.qml" ));
103
+ // const QUrl src = QUrl::fromLocalFile(QStringLiteral(":/qt/qml/org/ownCloud/qmlcomponents/qml/tree.qml"));
104
+ ui->quickWidget ->rootContext ()->setContextProperty (QStringLiteral (" ctx" ), this );
105
+ ui->quickWidget ->setSource (src);
106
+ ui->quickWidget ->engine ()->setNetworkAccessManagerFactory (new NetworkAccessManagerFactory (_accountState->account ().get ()));
107
+ ui->quickWidget ->setResizeMode (QQuickWidget::SizeRootObjectToView);
108
+ for (const auto &e : ui->quickWidget ->errors ()) {
109
+ qDebug () << " aaaaaaaaaaa" << e;
110
+ }
88
111
89
- ui->_folderList ->setItemDelegate (_delegate);
112
+ connect (ui->reload , &QPushButton::clicked, this , [src, this ] {
113
+ ui->quickWidget ->setSource (QUrl ());
114
+ ui->quickWidget ->engine ()->clearComponentCache ();
115
+ ui->quickWidget ->setSource (src);
116
+ for (const auto &e : ui->quickWidget ->errors ()) {
117
+ qDebug () << " aaaaaaaaaaa" << e;
118
+ }
119
+ });
90
120
91
121
createAccountToolbox ();
122
+ #if 0
92
123
connect(ui->_folderList, &QWidget::customContextMenuRequested,
93
124
this, &AccountSettings::slotCustomContextMenuRequested);
94
125
connect(ui->_folderList, &QAbstractItemView::clicked, this, &AccountSettings::slotFolderListClicked);
126
+ #endif
95
127
QAction *syncNowAction = new QAction (this );
96
128
connect (syncNowAction, &QAction::triggered, this , &AccountSettings::slotScheduleCurrentFolder);
97
129
addAction (syncNowAction);
@@ -157,8 +189,11 @@ void AccountSettings::createAccountToolbox()
157
189
158
190
Folder *AccountSettings::selectedFolder () const
159
191
{
192
+ return {};
193
+ #if 0
160
194
const QModelIndex selected = ui->_folderList->selectionModel()->currentIndex();
161
195
return _model->folder(_sortModel->mapToSource(selected));
196
+ #endif
162
197
}
163
198
164
199
void AccountSettings::slotToggleSignInState ()
@@ -172,6 +207,7 @@ void AccountSettings::slotToggleSignInState()
172
207
173
208
void AccountSettings::slotCustomContextMenuRequested (const QPoint &pos)
174
209
{
210
+ #if 0
175
211
auto *tv = ui->_folderList;
176
212
QModelIndex index = tv->indexAt(pos);
177
213
if (!index.isValid()) {
@@ -278,10 +314,12 @@ void AccountSettings::slotCustomContextMenuRequested(const QPoint &pos)
278
314
} else {
279
315
menu->deleteLater();
280
316
}
317
+ #endif
281
318
}
282
319
283
320
void AccountSettings::slotFolderListClicked (const QModelIndex &indx)
284
321
{
322
+ #if 0
285
323
// tries to find if we clicked on the '...' button.
286
324
auto *tv = ui->_folderList;
287
325
const auto pos = tv->mapFromGlobal(QCursor::pos());
@@ -294,6 +332,7 @@ void AccountSettings::slotFolderListClicked(const QModelIndex &indx)
294
332
emit showIssuesList();
295
333
return;
296
334
}
335
+ #endif
297
336
}
298
337
299
338
void AccountSettings::showSelectiveSyncDialog (Folder *folder)
@@ -352,6 +391,7 @@ void AccountSettings::slotFolderWizardAccepted()
352
391
353
392
void AccountSettings::slotRemoveCurrentFolder ()
354
393
{
394
+ #if 0
355
395
auto folder = selectedFolder();
356
396
QModelIndex selected = ui->_folderList->selectionModel()->currentIndex();
357
397
if (selected.isValid() && folder) {
@@ -382,10 +422,12 @@ void AccountSettings::slotRemoveCurrentFolder()
382
422
});
383
423
messageBox->open();
384
424
}
425
+ #endif
385
426
}
386
427
387
428
void AccountSettings::slotEnableVfsCurrentFolder ()
388
429
{
430
+ #if 0
389
431
QPointer<Folder> folder = selectedFolder();
390
432
QModelIndex selected = ui->_folderList->selectionModel()->currentIndex();
391
433
if (!selected.isValid() || !folder) {
@@ -405,10 +447,12 @@ void AccountSettings::slotEnableVfsCurrentFolder()
405
447
406
448
ui->_folderList->doItemsLayout();
407
449
}
450
+ #endif
408
451
}
409
452
410
453
void AccountSettings::slotDisableVfsCurrentFolder ()
411
454
{
455
+ #if 0
412
456
QPointer<Folder> folder = selectedFolder();
413
457
QModelIndex selected = ui->_folderList->selectionModel()->currentIndex();
414
458
if (!selected.isValid() || !folder)
@@ -440,6 +484,7 @@ void AccountSettings::slotDisableVfsCurrentFolder()
440
484
ui->_folderList->doItemsLayout();
441
485
});
442
486
msgBox->open();
487
+ #endif
443
488
}
444
489
445
490
void AccountSettings::showConnectionLabel (const QString &message, QStringList errors)
0 commit comments