diff options
Diffstat (limited to 'src-qt5/desktop-utils/lumina-fileinfo')
-rw-r--r-- | src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp | 50 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-fileinfo/MainUI.h | 3 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-fileinfo/MainUI.ui | 75 |
3 files changed, 127 insertions, 1 deletions
diff --git a/src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp b/src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp index e64346ae..c99a781e 100644 --- a/src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp +++ b/src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp @@ -191,6 +191,52 @@ void MainUI::SyncFileInfo(){ ui->tabWidget->addTab( ui->tab_deskedit, tr("XDG Shortcut") ); } ui->tabWidget->setCurrentIndex(ui->tabWidget->indexOf(ui->tab_file) ); + SyncZfsInfo(); +} + +void MainUI::SyncZfsInfo(){ + bool showtab = false; + if(INFO->zfsPool().isEmpty()){ + //Not on a ZFS pool - hide the tab if it is available + showtab = false; + }else{ + qDebug() << "Is a ZFS Dataset:" << INFO->isZfsDataset(); + ui->label_zfs_pool->setText(INFO->zfsPool()); + if(INFO->isZfsDataset()){ + ui->tree_zfs_props->clear(); + QJsonObject props = INFO->zfsProperties(); + QStringList keys = props.keys(); + for(int i=0; i<keys.length(); i++){ + ui->tree_zfs_props->addTopLevelItem( new QTreeWidgetItem(QStringList() << keys[i] << props.value(keys[i]).toObject().value("value").toString() << props.value(keys[i]).toObject().value("source").toString() ) ); + ui->tree_zfs_props->resizeColumnToContents(0); + ui->tree_zfs_props->resizeColumnToContents(1); + } + ui->tree_zfs_props->setVisible(!keys.isEmpty()); + showtab = !keys.isEmpty(); + }else{ + ui->tree_zfs_props->setVisible(false); + } + QStringList snaps = INFO->zfsSnapshots(); + ui->tree_zfs_snaps->clear(); + for(int i=0; i<snaps.length(); i++){ + QFileInfo finfo(snaps[i].section("::::",1,-1)); + ui->tree_zfs_snaps->addTopLevelItem( new QTreeWidgetItem(QStringList() << snaps[i].section("::::",0,0) << finfo.created().toString(Qt::SystemLocaleShortDate) << finfo.lastModified().toString(Qt::SystemLocaleShortDate) ) ); + ui->tree_zfs_snaps->resizeColumnToContents(0); + } + ui->tree_zfs_snaps->setVisible(!snaps.isEmpty()); + showtab = showtab || !snaps.isEmpty(); + } + if(showtab){ + //Make sure the tab is visible + if(ui->tabWidget->indexOf(ui->tab_zfs)<0){ + ui->tabWidget->addTab( ui->tab_zfs, tr("Advanced") ); + } + }else{ + //hide the tab if it is visible right now + if(ui->tabWidget->indexOf(ui->tab_zfs)>=0){ + ui->tabWidget->removeTab( ui->tabWidget->indexOf(ui->tab_zfs) ); + } + } } void MainUI::SetupNewFile(){ @@ -209,6 +255,10 @@ void MainUI::SetupNewFile(){ //qDebug() << "Adding the deskedit tab"; ui->tabWidget->addTab(ui->tab_deskedit, tr("XDG Shortcut")); } + //Not on a ZFS pool - hide the tab if it is available + if(ui->tabWidget->indexOf(ui->tab_zfs)>=0){ + ui->tabWidget->removeTab( ui->tabWidget->indexOf(ui->tab_zfs) ); + } ui->tabWidget->setCurrentIndex(ui->tabWidget->indexOf(ui->tab_deskedit) ); } diff --git a/src-qt5/desktop-utils/lumina-fileinfo/MainUI.h b/src-qt5/desktop-utils/lumina-fileinfo/MainUI.h index 3990f643..4e756a97 100644 --- a/src-qt5/desktop-utils/lumina-fileinfo/MainUI.h +++ b/src-qt5/desktop-utils/lumina-fileinfo/MainUI.h @@ -55,7 +55,7 @@ private: void GetDirSize(const QString dirname) const; //function to get folder size void SyncFileInfo(); - + void SyncZfsInfo(); void syncXdgStruct(XDGDesktop*); bool saveFile(QString path); @@ -66,6 +66,7 @@ signals: private slots: void SetupNewFile(); + //Initialization functions void SetupConnections(); diff --git a/src-qt5/desktop-utils/lumina-fileinfo/MainUI.ui b/src-qt5/desktop-utils/lumina-fileinfo/MainUI.ui index 217c1a10..5139bbf7 100644 --- a/src-qt5/desktop-utils/lumina-fileinfo/MainUI.ui +++ b/src-qt5/desktop-utils/lumina-fileinfo/MainUI.ui @@ -216,6 +216,81 @@ </item> </layout> </widget> + <widget class="QWidget" name="tab_zfs"> + <attribute name="title"> + <string>Advanced</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <item> + <layout class="QFormLayout" name="formLayout_2"> + <item row="0" column="0"> + <widget class="QLabel" name="label_9"> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>ZFS Pool:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="label_zfs_pool"> + <property name="text"> + <string notr="true">[pool]</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QTreeWidget" name="tree_zfs_props"> + <property name="sortingEnabled"> + <bool>true</bool> + </property> + <column> + <property name="text"> + <string>Property</string> + </property> + </column> + <column> + <property name="text"> + <string>Value</string> + </property> + </column> + <column> + <property name="text"> + <string>Source</string> + </property> + </column> + </widget> + </item> + <item> + <widget class="QTreeWidget" name="tree_zfs_snaps"> + <property name="sortingEnabled"> + <bool>true</bool> + </property> + <column> + <property name="text"> + <string>Snapshot</string> + </property> + </column> + <column> + <property name="text"> + <string>Date Created</string> + </property> + </column> + <column> + <property name="text"> + <string>Date Modified</string> + </property> + </column> + </widget> + </item> + </layout> + </widget> <widget class="QWidget" name="tab_deskedit"> <attribute name="title"> <string>XDG Shortcut</string> |