diff options
-rw-r--r-- | lumina-config/lumina-config.pro | 8 | ||||
-rw-r--r-- | lumina-desktop/SettingsMenu.cpp | 2 | ||||
-rw-r--r-- | lumina-desktop/lumina-desktop.pro | 8 | ||||
-rw-r--r-- | lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.ui | 61 | ||||
-rw-r--r-- | lumina-fm/FODialog.cpp | 111 | ||||
-rw-r--r-- | lumina-fm/FODialog.h | 4 | ||||
-rw-r--r-- | lumina-fm/MainUI.cpp | 22 | ||||
-rw-r--r-- | lumina-fm/lumina-fm.pro | 5 | ||||
-rw-r--r-- | lumina-open/lumina-open.pro | 4 | ||||
-rw-r--r-- | lumina-screenshot/lumina-screenshot.pro | 2 | ||||
-rw-r--r-- | lumina-search/lumina-search.pro | 2 |
11 files changed, 165 insertions, 64 deletions
diff --git a/lumina-config/lumina-config.pro b/lumina-config/lumina-config.pro index ec6d09e3..821daf05 100644 --- a/lumina-config/lumina-config.pro +++ b/lumina-config/lumina-config.pro @@ -34,13 +34,7 @@ FORMS += mainUI.ui \ INCLUDEPATH += ../libLumina $$PREFIX/include - LIBS += -L../libLumina -lLuminaUtils -#freebsd-* { -# LIBS += -lQtSolutions_SingleApplication-head -#} -#openbsd-g++4 { -# LIBS += -lQtSolutions_SingleApplication-head -#} +LIBS += -L../libLumina -L$$PREFIX/lib -lLuminaUtils openbsd-g++4 { LRELEASE = lrelease4 diff --git a/lumina-desktop/SettingsMenu.cpp b/lumina-desktop/SettingsMenu.cpp index 0e59d77b..d6b07ee4 100644 --- a/lumina-desktop/SettingsMenu.cpp +++ b/lumina-desktop/SettingsMenu.cpp @@ -18,7 +18,7 @@ SettingsMenu::~SettingsMenu(){ } void SettingsMenu::InitMenu(){ - this->setTitle( tr("Desktop Settings") ); + this->setTitle( tr("Settings") ); this->setIcon( LXDG::findIcon("configure","") ); connect(this, SIGNAL(triggered(QAction*)), this, SLOT(runApp(QAction*)) ); //Now setup the possible configuration options diff --git a/lumina-desktop/lumina-desktop.pro b/lumina-desktop/lumina-desktop.pro index 02581bdc..fdc12469 100644 --- a/lumina-desktop/lumina-desktop.pro +++ b/lumina-desktop/lumina-desktop.pro @@ -8,17 +8,13 @@ isEmpty(PREFIX) { } target.path = $$PREFIX/bin -LIBS += -L../libLumina -lLuminaUtils -lXdamage -lX11 -lxcb -lxcb-damage +LIBS += -L../libLumina -L$$PREFIX/lib -lLuminaUtils -lXdamage -lX11 -lxcb -lxcb-damage QMAKE_LIBDIR = ../libLumina DEPENDPATH += ../libLumina TEMPLATE = app -openbsd-g++4 { - LRELEASE = lrelease4 -} else { - LRELEASE = /usr/local/lib/qt5/bin/lrelease -} +LRELEASE = $$PREFIX/lib/qt5/bin/lrelease SOURCES += main.cpp \ WMProcess.cpp \ diff --git a/lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.ui b/lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.ui index 37cac2d4..8f58cae9 100644 --- a/lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.ui +++ b/lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.ui @@ -14,7 +14,7 @@ <string>Form</string> </property> <property name="styleSheet"> - <string notr="true">QGroupBox{ + <string notr="true">/*QGroupBox{ border-radius: 5px; border: 1px solid grey; margin-top: 1ex; @@ -25,14 +25,23 @@ subcontrol-position: top center; padding: 0 3px; background-color: rgba(255,255,255,255); border-radius: 5px; -font-weight: bold; -}</string> +font: bold; +}*/</string> </property> <layout class="QVBoxLayout" name="verticalLayout"> <property name="spacing"> <number>2</number> </property> - <property name="margin"> + <property name="leftMargin"> + <number>1</number> + </property> + <property name="topMargin"> + <number>1</number> + </property> + <property name="rightMargin"> + <number>1</number> + </property> + <property name="bottomMargin"> <number>1</number> </property> <item> @@ -47,7 +56,16 @@ font-weight: bold; <property name="spacing"> <number>2</number> </property> - <property name="margin"> + <property name="leftMargin"> + <number>2</number> + </property> + <property name="topMargin"> + <number>2</number> + </property> + <property name="rightMargin"> + <number>2</number> + </property> + <property name="bottomMargin"> <number>2</number> </property> <item> @@ -141,7 +159,16 @@ font-weight: bold; <property name="spacing"> <number>2</number> </property> - <property name="margin"> + <property name="leftMargin"> + <number>2</number> + </property> + <property name="topMargin"> + <number>2</number> + </property> + <property name="rightMargin"> + <number>2</number> + </property> + <property name="bottomMargin"> <number>2</number> </property> <item> @@ -204,7 +231,16 @@ font-weight: bold; <property name="spacing"> <number>2</number> </property> - <property name="margin"> + <property name="leftMargin"> + <number>2</number> + </property> + <property name="topMargin"> + <number>2</number> + </property> + <property name="rightMargin"> + <number>2</number> + </property> + <property name="bottomMargin"> <number>2</number> </property> <item> @@ -260,7 +296,16 @@ font-weight: bold; <property name="spacing"> <number>2</number> </property> - <property name="margin"> + <property name="leftMargin"> + <number>2</number> + </property> + <property name="topMargin"> + <number>2</number> + </property> + <property name="rightMargin"> + <number>2</number> + </property> + <property name="bottomMargin"> <number>2</number> </property> <item> diff --git a/lumina-fm/FODialog.cpp b/lumina-fm/FODialog.cpp index c8be3d85..4c61eb68 100644 --- a/lumina-fm/FODialog.cpp +++ b/lumina-fm/FODialog.cpp @@ -7,14 +7,17 @@ #include "FODialog.h" #include "ui_FODialog.h" +#include <QApplication> + FODialog::FODialog(QWidget *parent) : QDialog(parent), ui(new Ui::FODialog){ ui->setupUi(this); //load the designer file - ui->label->setText(""); + ui->label->setText(tr("Calculating")); ui->progressBar->setVisible(false); ui->push_stop->setIcon( LXDG::findIcon("edit-delete","") ); //Now set the internal defaults isRM = isCP = isRESTORE = isMV = stopped = noerrors = false; overwrite = -1; //set to automatic by default + this->show(); } FODialog::~FODialog(){ @@ -61,25 +64,36 @@ void FODialog::MoveFiles(QStringList oldPaths, QStringList newPaths){ } // ==== PRIVATE ==== -QStringList FODialog::subfiles(QString dirpath){ +QStringList FODialog::subfiles(QString dirpath, bool dirsfirst){ + //NOTE: dirpath (input) is always the first/last item in the output as well! QStringList out; + if(dirsfirst){ out << dirpath; } if( QFileInfo(dirpath).isDir() ){ QDir dir(dirpath); - //First list the files + if(dirsfirst){ + //Now recursively add any subdirectories and their contents + QStringList subdirs = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::NoSort); + for(int i=0; i<subdirs.length(); i++){ out << subfiles(dir.absoluteFilePath(subdirs[i]), dirsfirst); } + } + //List the files QStringList files = dir.entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::NoSort); for(int i=0; i<files.length(); i++){ out << dir.absoluteFilePath(files[i]); } - //Now recursively add any subdirectories and their contents - QStringList subdirs = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::NoSort); - for(int i=0; i<subdirs.length(); i++){ out << subfiles(dir.absoluteFilePath(subdirs[i])); } + + if(!dirsfirst){ + //Now recursively add any subdirectories and their contents + QStringList subdirs = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::NoSort); + for(int i=0; i<subdirs.length(); i++){ out << subfiles(dir.absoluteFilePath(subdirs[i]), dirsfirst); } + } } - out << dirpath; //always put the parent directory after all the contents + if(!dirsfirst){ out << dirpath; } return out; } QString FODialog::newFileName(QString path){ int num=1; - QString extension = path.section(".",-1); - if(!extension.isEmpty()){ + QString extension = path.section("/",-1).section(".",-1); + if( path.section("/",-1) == "."+extension || extension ==path.section("/",-1) ){ extension.clear(); } //just a hidden file without extension or directory + if(!extension.isEmpty() ){ extension.prepend("."); path.chop(extension.length()); } @@ -87,8 +101,12 @@ QString FODialog::newFileName(QString path){ return QString(path+"-"+QString::number(num)+extension); } -QStringList FODialog::removeItem(QString path){ - QStringList items = subfiles(path); +QStringList FODialog::removeItem(QString path, bool recursive){ + //qDebug() << "Remove Path:" << path; + QStringList items; + if(recursive){ items = subfiles(path,false); } + else{ items << path; } //only the given path + //qDebug() << " - Subfiles:" << items; QStringList err; for(int i=0; i<items.length(); i++){ if(QFileInfo(items[i]).isDir()){ @@ -98,7 +116,7 @@ QStringList FODialog::removeItem(QString path){ if( !dir.rmdir(items[i]) ){ err << items[i]; } }else{ //Recursive Directory Removal - err << removeItem(items[i]); + err << removeItem(items[i], recursive); } }else{ //Simple File Removal @@ -111,14 +129,11 @@ QStringList FODialog::removeItem(QString path){ QStringList FODialog::copyItem(QString oldpath, QString newpath){ QStringList err; if(QFileInfo(oldpath).isDir()){ + //Create a new directory with the same name (no way to copy dir+contents) QDir dir; if( !dir.mkpath(newpath) ){ err << oldpath; } - else{ - dir.cd(oldpath); - QStringList subs = dir.entryList(QDir::Files | QDir::Files | QDir::NoDotAndDotDot, QDir::Name | QDir::DirsFirst); - for(int i=0; i<subs.length(); i++){ err << copyItem(oldpath+"/"+subs[i], newpath+"/"+subs[i]); } - } }else{ + //Copy the file and reset permissions as necessary if( !QFile::copy(oldpath, newpath) ){ err << oldpath; } else{ if(isCP){ @@ -136,10 +151,12 @@ QStringList FODialog::copyItem(QString oldpath, QString newpath){ // ==== PRIVATE SLOTS ==== void FODialog::slotStartOperations(){ ui->label->setText(tr("Calculating...")); + //qDebug() << "Start File operations" << isRM << isCP << isMV << ofiles << nfiles; //Now setup the UI ui->progressBar->setRange(0,ofiles.length()); ui->progressBar->setValue(0); ui->progressBar->setVisible(true); + QApplication::processEvents(); if(!isRM && overwrite==-1){ //Check if the new files already exist, and prompt for action QStringList existing; @@ -154,22 +171,63 @@ void FODialog::slotStartOperations(){ else{ this->close(); return; } //cancel operations } } + //Get the complete number of items to be operated on (better tracking) + QStringList olist, nlist; //old/new list + for(int i=0; i<ofiles.length(); i++){ + if(isRM){ //only old files + olist << subfiles(ofiles[i], false); //dirs need to be last for removals + }else if(isCP || isRESTORE){ + if(QFile::exists(nfiles[i])){ + if(!overwrite){ + nfiles[i] = newFileName(nfiles[i]); //prompt for new file name up front before anything starts + } + } + QStringList subs = subfiles(ofiles[i], true); //dirs need to be first for additions + for(int s=0; s<subs.length(); s++){ + olist << subs[s]; + QString newsub = subs[s].section(ofiles[i],0,100, QString::SectionSkipEmpty); + newsub.prepend(nfiles[i]); + nlist << newsub; + } + }else{ //Move/rename + if( nfiles[i].startsWith(ofiles[i]+"/") ){ + //This is trying to move a directory into itself (not possible) + // Example: move "~/mydir" -> "~/mydir/mydir2" + QMessageBox::warning(this, tr("Invalid Move"), QString(tr("It is not possible to move a directory into itself. Please make a copy of the directory instead.\n\nOld Location: %1\nNew Location: %2")).arg(ofiles[i], nfiles[i]) ); + }else{ + //no changes necessary + olist << ofiles[i]; + nlist << nfiles[i]; + } + } + } //Now start iterating over the operations QStringList errlist; - for(int i=0; i<ofiles.length() && !stopped; i++){ + for(int i=0; i<olist.length() && !stopped; i++){ if(isRM){ - ui->label->setText( QString(tr("Removing: %1")).arg(ofiles[i].section("/",-1)) ); - errlist << removeItem(ofiles[i]); + ui->label->setText( QString(tr("Removing: %1")).arg(olist[i].section("/",-1)) ); + errlist << removeItem(olist[i]); }else if(isCP || isRESTORE){ - ui->label->setText( QString(tr("Copying: %1 to %2")).arg(ofiles[i].section("/",-1), nfiles[i].section("/",-1)) ); - if(QFile::exists(nfiles[i])){ + ui->label->setText( QString(tr("Copying: %1 to %2")).arg(olist[i].section("/",-1), nlist[i].section("/",-1)) ); + if(QFile::exists(nlist[i])){ if(overwrite){ - errlist << removeItem(nfiles[i]); - }else{ - nfiles[i] = newFileName(nfiles[i]); + errlist << removeItem(nlist[i], true); //recursively remove the file/dir since we are supposed to overwrite it } } - errlist << copyItem(ofiles[i], nfiles[i]); + //If a parent directory fails to copy, skip all the children as well (they will also fail) + if( !errlist.contains(olist[i].section("/",0,-1)) ){ + errlist << copyItem(olist[i], nlist[i]); + } + /*if(err.isEmpty() && !subs.isEmpty() ){ //make sure the initial parent dir did not error out + //For copies of directories, also need to copy over all the sub files/dirs + for(int s=0; s<subs.length(); s++){ + //Replace the old parent directory path with the new parent directory path; + QString newsub = subs[s].section(ofiles[i],0,100, QString::SectionSkipEmpty); + newsub.prepend(nfiles[i]); + //qDebug() << "Copy Sub:" << subs[s] << newsub; + errlist << copyItem(subs[s], newsub); + } + }*/ }else if(isMV){ ui->label->setText( QString(tr("Moving: %1 to %2")).arg(ofiles[i].section("/",-1), nfiles[i].section("/",-1)) ); if( !QFile::rename(ofiles[i], nfiles[i]) ){ @@ -177,6 +235,7 @@ void FODialog::slotStartOperations(){ } } ui->progressBar->setValue(i+1); + QApplication::processEvents(); } //All finished, so close the dialog if successful errlist.removeAll(""); //make sure to clear any empty items diff --git a/lumina-fm/FODialog.h b/lumina-fm/FODialog.h index e823fe2e..e455c995 100644 --- a/lumina-fm/FODialog.h +++ b/lumina-fm/FODialog.h @@ -47,9 +47,9 @@ private: int overwrite; // [-1= auto, 0= no overwrite, 1= overwrite] QStringList ofiles, nfiles; //original/new files - QStringList subfiles(QString dirpath); //recursive function for fetching all "child" files/dirs (dirs last) + QStringList subfiles(QString dirpath, bool dirsfirst = false); //recursive function for fetching all "child" files/dirs (dirs last by default) QString newFileName(QString path); - QStringList removeItem(QString path); + QStringList removeItem(QString path, bool recursive = false); QStringList copyItem(QString oldpath, QString newpath); private slots: diff --git a/lumina-fm/MainUI.cpp b/lumina-fm/MainUI.cpp index 03e7a533..f77d8290 100644 --- a/lumina-fm/MainUI.cpp +++ b/lumina-fm/MainUI.cpp @@ -1105,12 +1105,17 @@ void MainUI::RemoveItem(){ if(!checkUserPerms()){ return; } //Get the selected items QStringList paths, names; - QFileInfoList sel = getSelectedItems(); - for(int i=0; i<sel.length(); i++){ - paths << sel[i].absoluteFilePath(); - names << sel[i].fileName(); - } - if(sel.isEmpty()){ return; } //nothing selected + if(CItem.isEmpty()){ + QFileInfoList sel = getSelectedItems(); + for(int i=0; i<sel.length(); i++){ + paths << sel[i].absoluteFilePath(); + names << sel[i].fileName(); + } + if(sel.isEmpty()){ return; } //nothing selected + }else{ + paths << CItem; + names << CItem.section("/",-1); + } //Verify permanent removal of file/dir if(QMessageBox::Yes != QMessageBox::question(this, tr("Verify Removal"), tr("WARNING: This will permanently delete the file(s) from the system!")+"\n"+tr("Are you sure you want to continue?")+"\n\n"+names.join("\n"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) ){ return; //cancelled @@ -1119,7 +1124,9 @@ void MainUI::RemoveItem(){ qDebug() << "Delete: "<<paths; FODialog dlg(this); dlg.RemoveFiles(paths); + dlg.show(); dlg.exec(); + CItem.clear(); } void MainUI::RenameItem(){ @@ -1160,6 +1167,7 @@ void MainUI::RenameItem(){ FODialog dlg(this); dlg.setOverwrite(overwrite); dlg.MoveFiles(QStringList() << path+fname, QStringList() << path+nname); + dlg.show(); dlg.exec(); CItem.clear(); } @@ -1248,6 +1256,7 @@ void MainUI::PasteItems(){ qDebug() << "Paste Copy:" << copy << "->" << newcopy; FODialog dlg(this); dlg.CopyFiles(copy, newcopy); + dlg.show(); dlg.exec(); errs = errs || !dlg.noerrors; } @@ -1255,6 +1264,7 @@ void MainUI::PasteItems(){ qDebug() << "Paste Cut:" << cut << "->" << newcut; FODialog dlg(this); dlg.MoveFiles(cut, newcut); + dlg.show(); dlg.exec(); errs = errs || !dlg.noerrors; } diff --git a/lumina-fm/lumina-fm.pro b/lumina-fm/lumina-fm.pro index d0fb713b..1f092894 100644 --- a/lumina-fm/lumina-fm.pro +++ b/lumina-fm/lumina-fm.pro @@ -30,10 +30,7 @@ FORMS += MainUI.ui \ INCLUDEPATH += ../libLumina $$PREFIX/include - LIBS += -L../libLumina -lLuminaUtils -/*freebsd-* { - LIBS += -lQtSolutions_SingleApplication-head -}*/ +LIBS += -L../libLumina -L$$PREFIX/lib -lLuminaUtils openbsd-g++4 { LRELEASE = lrelease4 diff --git a/lumina-open/lumina-open.pro b/lumina-open/lumina-open.pro index ce0e231d..d713c4c2 100644 --- a/lumina-open/lumina-open.pro +++ b/lumina-open/lumina-open.pro @@ -20,14 +20,14 @@ FORMS += LFileDialog.ui RESOURCES+= lumina-open.qrc INCLUDEPATH += ../libLumina $$PREFIX/include -LIBS += -L../libLumina -lLuminaUtils +LIBS += -L../libLumina -L$$PREFIX/lib -lLuminaUtils QMAKE_LIBDIR = ../libLumina DEPENDPATH += ../libLumina openbsd-g++4 { LRELEASE = lrelease4 } else { - LRELEASE = lrelease-qt4 + LRELEASE = $$PREFIX/lib/qt5/bin/lrelease } TRANSLATIONS = i18n/lumina-open_af.ts \ diff --git a/lumina-screenshot/lumina-screenshot.pro b/lumina-screenshot/lumina-screenshot.pro index b43d582c..7a47f7fe 100644 --- a/lumina-screenshot/lumina-screenshot.pro +++ b/lumina-screenshot/lumina-screenshot.pro @@ -19,7 +19,7 @@ FORMS += MainUI.ui INCLUDEPATH += ../libLumina $$PREFIX/include -LIBS += -L../libLumina -lLuminaUtils +LIBS += -L../libLumina -L$$PREFIX/lib -lLuminaUtils LRELEASE = $$PREFIX/lib/qt5/bin/lrelease diff --git a/lumina-search/lumina-search.pro b/lumina-search/lumina-search.pro index fcc6ae0f..dba757dc 100644 --- a/lumina-search/lumina-search.pro +++ b/lumina-search/lumina-search.pro @@ -21,7 +21,7 @@ FORMS += MainUI.ui INCLUDEPATH += ../libLumina $$PREFIX/include -LIBS += -L../libLumina -lLuminaUtils +LIBS += -L../libLumina -L$$PREFIX/lib -lLuminaUtils LRELEASE = $$PREFIX/lib/qt5/bin/lrelease |