Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/Remmina/QRema.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/qremamain.cpp')
-rw-r--r--src/qremamain.cpp78
1 files changed, 78 insertions, 0 deletions
diff --git a/src/qremamain.cpp b/src/qremamain.cpp
new file mode 100644
index 0000000..76b4dd3
--- /dev/null
+++ b/src/qremamain.cpp
@@ -0,0 +1,78 @@
+#include "qremamain.h"
+#include "ui_qremamain.h"
+
+
+QRemaMain::QRemaMain(QWidget *parent) :
+ QMainWindow(parent),
+ ui(new Ui::QRemaMain)
+{
+ ui->setupUi(this);
+ QString mPath = "/home/antenore/remmina/profiles";
+ dirModel = new QFileSystemModel(this);
+
+ // Set filter
+ dirModel->setFilter(QDir::NoDotAndDotDot |
+ QDir::AllDirs);
+
+ // QFileSystemModel requires root path
+ dirModel->setRootPath(mPath);
+
+ // Attach the model to the view
+ ui->treeView->setModel(dirModel);
+ ui->treeView->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
+ ui->treeView->setHeaderHidden(true);
+ ui->treeView->setColumnHidden(1, true);
+ ui->treeView->setColumnHidden(2, true);
+ ui->treeView->setColumnHidden(3, true);
+
+ ui->treeView->setRootIndex(dirModel->index(mPath));
+
+
+ // FILES
+
+ fileModel = new QFileSystemModel(this);
+
+ // Set filter
+ fileModel->setFilter(QDir::Files | QDir::NoDotAndDotDot);
+
+ // QFileSystemModel requires root path
+ fileModel->setRootPath(mPath);
+
+ // Only remmina files
+ fileModel->setNameFilters(QStringList()<<"*.remmina");
+
+
+ // Attach the model to the view
+ ui->listView->setModel(fileModel);
+ ui->listView->setWordWrap( true );
+ ui->listView->setViewMode(QListView::IconMode);
+ ui->listView->setIconSize(QSize(64, 64));
+ ui->listView->setResizeMode(QListView::Adjust);
+
+ ui->listView->setRootIndex(fileModel->index(mPath));
+
+
+}
+
+QRemaMain::~QRemaMain()
+{
+ delete ui;
+}
+
+void QRemaMain::on_treeView_clicked(const QModelIndex &index)
+{
+ // TreeView clicked
+ // 1. We need to extract path
+ // 2. Set that path into our ListView
+
+ // Get the full path of the item that's user clicked on
+ QString mPath = dirModel->fileInfo(index).absoluteFilePath();
+ ui->listView->setRootIndex(fileModel->setRootPath(mPath));
+
+}
+
+void QRemaMain::on_listView_doubleClicked(const QModelIndex &index)
+{
+ QString sPath = fileModel->fileInfo(index).absoluteFilePath();
+ QDesktopServices::openUrl(QUrl::fromLocalFile(sPath));
+}