aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lumina-fileinfo/dialog.cpp43
-rw-r--r--lumina-fileinfo/dialog.ui483
2 files changed, 368 insertions, 158 deletions
diff --git a/lumina-fileinfo/dialog.cpp b/lumina-fileinfo/dialog.cpp
index 19e935ad..29b5fd21 100644
--- a/lumina-fileinfo/dialog.cpp
+++ b/lumina-fileinfo/dialog.cpp
@@ -4,11 +4,11 @@
#include <QRegExp>
#include <QTemporaryFile>
#include <QMessageBox>
+#include <QImageReader>
#include "LuminaUtils.h"
#include <LuminaOS.h>
-
//this function is just like a regexp.
//we just change the required lines and we don't touch to the rest of the file and copy it back.
void Dialog::textReplace(QString &origin, QString from, QString to, QString topic)
@@ -129,7 +129,41 @@ void Dialog::LoadDesktopFile(QString input)
copyTemplate("-app");
}
}
-
+ this->setWindowTitle(desktopFileName.section("/",-1));
+ ui->tabWidget->setCurrentIndex(0); //always start on the file info tab
+ //Now load the file info and put it into the UI
+ QFileInfo info(desktopFileName);
+ QString mime = LXDG::findAppMimeForFile(desktopFileName);
+
+ QList<QByteArray> fmt = QImageReader::supportedImageFormats();
+ bool foundimage=false;
+ for(int i=0; i<fmt.length(); i++){
+ if(info.suffix().toLower() == QString(fmt[i]).toLower()){foundimage=true; break; }
+ }
+ if(foundimage){
+ ui->label_file_icon->setPixmap( QPixmap(desktopFileName).scaledToHeight(64) );
+ }else{
+ ui->label_file_icon->setPixmap( LXDG::findMimeIcon(mime).pixmap(QSize(64,64)) );
+ }
+ ui->label_file_mimetype->setText(mime);
+ QString type;
+ if(desktopFileName.endsWith(".desktop")){ type = tr("XDG Shortcut"); }
+ else if(info.isDir()){ type = tr("Directory"); ui->label_file_icon->setPixmap( LXDG::findIcon("folder","").pixmap(QSize(64,64)) ); }
+ else if(info.isExecutable()){ type = tr("Binary"); }
+ else{ type = info.suffix().toUpper(); }
+ if(info.isHidden()){ type = QString(tr("Hidden %1")).arg(type); }
+ ui->label_file_type->setText(type);
+ ui->label_file_owner->setText(info.owner());
+ ui->label_file_group->setText(info.group());
+ QString perms;
+ if(info.isReadable() && info.isWritable()){ perms = tr("Read/Write"); }
+ else if(info.isReadable()){ perms = tr("Read Only"); }
+ else if(info.isWritable()){ perms = tr("Write Only"); }
+ else{ perms = tr("No Access"); }
+ ui->label_file_perms->setText(perms);
+ ui->label_file_created->setText( info.created().toString(Qt::SystemLocaleLongDate) );
+ ui->label_file_modified->setText( info.lastModified().toString(Qt::SystemLocaleLongDate) );
+
//use the standard LXDG object and load the desktop file
bool ok = false;
if(desktopFileName.endsWith(".desktop")){
@@ -153,10 +187,9 @@ void Dialog::LoadDesktopFile(QString input)
if (DF.useTerminal) ui->cbRunInTerminal->setChecked(true); else ui->cbRunInTerminal->setChecked(false);
iconFileName="";
ui->pbIcon->setIcon(LXDG::findIcon(DF.icon,""));
- this->setWindowTitle(DF.filePath.section("/",-1));
} else {
- QMessageBox::critical(this, tr("Error"), tr("Invalid File Supplied:") +"\n"+desktopFileName );
- exit(1);
+ ui->tabWidget->removeTab(1);
+ return;
}
//we load the file in memory and will adapt it before saving it to disk
diff --git a/lumina-fileinfo/dialog.ui b/lumina-fileinfo/dialog.ui
index 311c2ff0..16ad6158 100644
--- a/lumina-fileinfo/dialog.ui
+++ b/lumina-fileinfo/dialog.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>383</width>
- <height>288</height>
+ <width>349</width>
+ <height>327</height>
</rect>
</property>
<property name="windowTitle">
@@ -15,162 +15,339 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
- <layout class="QGridLayout" name="gridLayout">
- <item row="3" column="0" alignment="Qt::AlignRight">
- <widget class="QLabel" name="lblWorkingDir">
- <property name="text">
- <string>Working dir:</string>
+ <widget class="QTabWidget" name="tabWidget">
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <property name="tabBarAutoHide">
+ <bool>true</bool>
+ </property>
+ <widget class="QWidget" name="tab_file">
+ <attribute name="title">
+ <string>File Properties</string>
+ </attribute>
+ <layout class="QFormLayout" name="formLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_file_icon">
+ <property name="text">
+ <string notr="true">icon</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" colspan="2">
+ <widget class="Line" name="line_2">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Owner:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1">
+ <widget class="QLabel" name="label_file_owner">
+ <property name="text">
+ <string notr="true"/>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0">
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Group:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="1">
+ <widget class="QLabel" name="label_file_group">
+ <property name="text">
+ <string notr="true"/>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="0">
+ <widget class="QLabel" name="label_11">
+ <property name="text">
+ <string>Permissions:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="9" column="0" colspan="2">
+ <widget class="Line" name="line_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="10" column="0">
+ <widget class="QLabel" name="label_7">
+ <property name="text">
+ <string>Created:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="10" column="1">
+ <widget class="QLabel" name="label_file_created">
+ <property name="toolTip">
+ <string>Note: The time a file was created might be more recent than the time modified if the file permissions were changed recently.</string>
+ </property>
+ <property name="text">
+ <string notr="true"/>
+ </property>
+ </widget>
+ </item>
+ <item row="11" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Last Modified:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_5">
+ <property name="text">
+ <string>Type:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_6">
+ <property name="text">
+ <string>MimeType:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLabel" name="label_file_mimetype">
+ <property name="text">
+ <string notr="true"/>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLabel" name="label_file_type">
+ <property name="text">
+ <string notr="true"/>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="1">
+ <widget class="QLabel" name="label_file_perms">
+ <property name="text">
+ <string notr="true"/>
+ </property>
+ </widget>
+ </item>
+ <item row="11" column="1">
+ <widget class="QLabel" name="label_file_modified">
+ <property name="text">
+ <string notr="true"/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tab_deskedit">
+ <attribute name="title">
+ <string>Edit Shortcut</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <property name="spacing">
+ <number>2</number>
</property>
- </widget>
- </item>
- <item row="3" column="2">
- <widget class="QPushButton" name="pbWorkingDir">
- <property name="enabled">
- <bool>true</bool>
+ <property name="leftMargin">
+ <number>4</number>
</property>
- <property name="text">
- <string/>
+ <property name="topMargin">
+ <number>4</number>
</property>
- <property name="icon">
- <iconset>
- <normalon>../../../../usr/local/share/icons/gnome/32x32/places/folder.png</normalon>
- </iconset>
+ <property name="rightMargin">
+ <number>4</number>
</property>
- </widget>
- </item>
- <item row="2" column="2">
- <widget class="QPushButton" name="pbCommand">
- <property name="text">
- <string/>
+ <property name="bottomMargin">
+ <number>4</number>
</property>
- <property name="icon">
- <iconset>
- <normalon>../../../../usr/local/share/icons/gnome/32x32/actions/gnome-run.png</normalon>
- </iconset>
- </property>
- </widget>
- </item>
- <item row="5" column="1">
- <widget class="QCheckBox" name="cbStartupNotification">
- <property name="text">
- <string>Use startup notification</string>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QLineEdit" name="lWorkingDir">
- <property name="enabled">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="4" column="0" alignment="Qt::AlignRight">
- <widget class="QLabel" name="lblIcon">
- <property name="text">
- <string>Icon:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0" alignment="Qt::AlignRight">
- <widget class="QLabel" name="lblCommand">
- <property name="text">
- <string>Command:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0" alignment="Qt::AlignRight">
- <widget class="QLabel" name="lblComment">
- <property name="text">
- <string>Comment:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QLineEdit" name="lCommand"/>
- </item>
- <item row="4" column="1" alignment="Qt::AlignLeft">
- <widget class="QPushButton" name="pbIcon">
- <property name="maximumSize">
- <size>
- <width>275</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset>
- <normalon>../../../../usr/local/share/icons/gnome/32x32/categories/xfce-graphics.png</normalon>
- </iconset>
- </property>
- <property name="iconSize">
- <size>
- <width>64</width>
- <height>64</height>
- </size>
- </property>
- </widget>
- </item>
- <item row="6" column="1">
- <widget class="QCheckBox" name="cbRunInTerminal">
- <property name="text">
- <string>Run in terminal</string>
- </property>
- </widget>
- </item>
- <item row="0" column="0" alignment="Qt::AlignRight">
- <widget class="QLabel" name="lblName">
- <property name="text">
- <string>Name:</string>
- </property>
- </widget>
- </item>
- <item row="5" column="0" alignment="Qt::AlignRight">
- <widget class="QLabel" name="lblOptions">
- <property name="text">
- <string>Options</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1" colspan="2">
- <widget class="QLineEdit" name="lName"/>
- </item>
- <item row="1" column="1" colspan="2">
- <widget class="QLineEdit" name="lComment"/>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="pbCancel">
- <property name="text">
- <string>Cancel</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="pbApply">
- <property name="text">
- <string>Apply</string>
- </property>
- </widget>
- </item>
- </layout>
+ <item>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="3" column="0" alignment="Qt::AlignRight">
+ <widget class="QLabel" name="lblWorkingDir">
+ <property name="text">
+ <string>Working dir:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="2">
+ <widget class="QPushButton" name="pbWorkingDir">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset>
+ <normalon>../../../../usr/local/share/icons/gnome/32x32/places/folder.png</normalon>
+ </iconset>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2">
+ <widget class="QPushButton" name="pbCommand">
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset>
+ <normalon>../../../../usr/local/share/icons/gnome/32x32/actions/gnome-run.png</normalon>
+ </iconset>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="1">
+ <widget class="QCheckBox" name="cbStartupNotification">
+ <property name="text">
+ <string>Use startup notification</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QLineEdit" name="lWorkingDir">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0" alignment="Qt::AlignRight">
+ <widget class="QLabel" name="lblIcon">
+ <property name="text">
+ <string>Icon:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" alignment="Qt::AlignRight">
+ <widget class="QLabel" name="lblCommand">
+ <property name="text">
+ <string>Command:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" alignment="Qt::AlignRight">
+ <widget class="QLabel" name="lblComment">
+ <property name="text">
+ <string>Comment:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLineEdit" name="lCommand"/>
+ </item>
+ <item row="4" column="1" alignment="Qt::AlignLeft">
+ <widget class="QPushButton" name="pbIcon">
+ <property name="maximumSize">
+ <size>
+ <width>275</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset>
+ <normalon>../../../../usr/local/share/icons/gnome/32x32/categories/xfce-graphics.png</normalon>
+ </iconset>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>64</width>
+ <height>64</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="1">
+ <widget class="QCheckBox" name="cbRunInTerminal">
+ <property name="text">
+ <string>Run in terminal</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0" alignment="Qt::AlignRight">
+ <widget class="QLabel" name="lblName">
+ <property name="text">
+ <string>Name:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0" alignment="Qt::AlignRight">
+ <widget class="QLabel" name="lblOptions">
+ <property name="text">
+ <string>Options</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" colspan="2">
+ <widget class="QLineEdit" name="lName"/>
+ </item>
+ <item row="1" column="1" colspan="2">
+ <widget class="QLineEdit" name="lComment"/>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="Line" name="line">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="pbCancel">
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="pbApply">
+ <property name="text">
+ <string>Apply</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </widget>
</item>
</layout>
</widget>
bgstack15