MCPcopy Create free account
hub / github.com/baumgarr/nixnote2 / WatchFolderAdd

Method WatchFolderAdd

dialog/watchfolderadd.cpp:29–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27#include <QDir>
28
29WatchFolderAdd::WatchFolderAdd(qint32 lid, QWidget *parent) :
30 QDialog(parent)
31{
32 mainLayout = new QVBoxLayout();
33 okClicked = false;
34 fileDialog = new QFileDialog(this);
35 QString dir = QDir::home().absolutePath();
36 bool includeSubdirs = false;
37 qint32 notebookLid = 0;
38 FileWatcher::ScanType type = FileWatcher::ImportKeep;
39 this->lid = lid;
40 if (lid > 0) {
41 FileWatcherTable ft(global.db);
42 ft.get(lid, dir, type, notebookLid, includeSubdirs);
43 }
44
45
46 okButton = new QPushButton(this);
47 okButton->setText(tr("OK"));
48 connect(okButton, SIGNAL(clicked()), this, SLOT(onClicked()));
49
50 cancelButton = new QPushButton(this);
51 cancelButton->setText(tr("Cancel"));
52 connect(cancelButton, SIGNAL(clicked()), this, SLOT(onCancel()));
53
54 folderButton = new QPushButton(this);
55 folderButton->setText(tr("Directory"));
56 connect(folderButton, SIGNAL(clicked()), this, SLOT(folderButtonClicked()));
57
58 directory = new QLabel(this);
59 directory->setText(dir);
60
61
62 keep = new QComboBox(this);
63 keep->addItem(tr("Keep"),"keep");
64 keep->addItem(tr("Delete"),"delete");
65 if (type == FileWatcher::ImportKeep)
66 keep->setCurrentIndex(0);
67 else
68 keep->setCurrentIndex(1);
69
70 subdirs = new QCheckBox(this);
71 subdirs->setChecked(includeSubdirs);
72
73 books = new QComboBox(this);
74 NotebookTable ntable(global.db);
75 QList<qint32> lids;
76 ntable.getAll(lids);
77 for (int i=0; i<lids.size(); i++) {
78 Notebook n;
79 ntable.get(n, lids[i]);
80 books->addItem(n.name, lids[i]);
81 if (lids[i] == notebookLid)
82 books->setCurrentIndex(i);
83 }
84 books->model()->sort(0);
85
86

Callers

nothing calls this directly

Calls 7

addItemMethod · 0.80
modelMethod · 0.80
addWidgetMethod · 0.80
getGuiFontMethod · 0.80
getMethod · 0.45
setTextMethod · 0.45
getAllMethod · 0.45

Tested by

no test coverage detected