aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/desktop-utils/lumina-fm/widgets
diff options
context:
space:
mode:
authorWeblate <noreply@weblate.org>2016-12-14 21:54:31 +0000
committerWeblate <noreply@weblate.org>2016-12-14 21:54:31 +0000
commitb965af1625a4296f8ff6d3a1663cae23b73d334f (patch)
tree459685dd1da8c75f67772762aa062d80dfc148f0 /src-qt5/desktop-utils/lumina-fm/widgets
parentTranslated using Weblate (lumina_DESKTOP@fr (generated)) (diff)
parentMerge branch 'master' of github.com:trueos/lumina (diff)
downloadlumina-b965af1625a4296f8ff6d3a1663cae23b73d334f.tar.gz
lumina-b965af1625a4296f8ff6d3a1663cae23b73d334f.tar.bz2
lumina-b965af1625a4296f8ff6d3a1663cae23b73d334f.zip
Merge branch 'master' of github.com:trueos/lumina
Diffstat (limited to 'src-qt5/desktop-utils/lumina-fm/widgets')
-rw-r--r--src-qt5/desktop-utils/lumina-fm/widgets/DDListWidgets.h40
-rw-r--r--src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp30
2 files changed, 42 insertions, 28 deletions
diff --git a/src-qt5/desktop-utils/lumina-fm/widgets/DDListWidgets.h b/src-qt5/desktop-utils/lumina-fm/widgets/DDListWidgets.h
index 8049600e..254362fd 100644
--- a/src-qt5/desktop-utils/lumina-fm/widgets/DDListWidgets.h
+++ b/src-qt5/desktop-utils/lumina-fm/widgets/DDListWidgets.h
@@ -24,7 +24,7 @@
#include <QUrl>
#include <QDir>
-#include <LuminaUtils.h>
+#include <LUtils.h>
//==============
// LIST WIDGET
@@ -45,6 +45,7 @@ public:
this->setWrapping(true);
this->setMouseTracking(true);
this->setSortingEnabled(true); //This sorts *only* by name - type is not preserved
+ //this->setStyleSheet("QListWidget::item{ border: 1px solid transparent; border-radius: 5px; background-color: transparent;} QListWidget::item:hover{ border-color: black; } QListWidget::item:focus{ border-color: lightblue; }");
}
~DDListWidget(){}
@@ -63,9 +64,10 @@ protected:
if(items.length()<1){ return; }
QList<QUrl> urilist;
for(int i=0; i<items.length(); i++){
- urilist << QUrl::fromLocalFile(items[i]->whatsThis().section("::::",1,100));
+ urilist << QUrl::fromLocalFile(items[i]->whatsThis());
}
//Create the mime data
+ //qDebug() << "Start Drag:" << urilist;
QMimeData *mime = new QMimeData;
mime->setUrls(urilist);
//Create the drag structure
@@ -84,19 +86,23 @@ protected:
ev->acceptProposedAction(); //allow this to be dropped here
}else{
ev->ignore();
- }
+ }
}
void dragMoveEvent(QDragMoveEvent *ev){
if(ev->mimeData()->hasUrls() && !this->whatsThis().isEmpty() ){
//Change the drop type depending on the data/dir
QString home = QDir::homePath();
- if( this->whatsThis().startsWith(home) ){ ev->setDropAction(Qt::MoveAction); }
- else{ ev->setDropAction(Qt::CopyAction); }
+ //qDebug() << "Drag Move:" << home << this->whatsThis();
+ if( this->whatsThis().startsWith(home) ){ ev->setDropAction(Qt::MoveAction); this->setCursor(Qt::DragMoveCursor); }
+ else{ ev->setDropAction(Qt::CopyAction); this->setCursor(Qt::DragCopyCursor);}
ev->acceptProposedAction(); //allow this to be dropped here
+ //this->setCursor(Qt::CrossCursor);
}else{
+ this->setCursor(Qt::ForbiddenCursor);
ev->ignore();
}
+ this->update();
}
void dropEvent(QDropEvent *ev){
@@ -107,7 +113,8 @@ protected:
//See if the item under the drop point is a directory or not
QListWidgetItem *it = this->itemAt( ev->pos());
if(it!=0){
- QFileInfo info(it->whatsThis().section("::::",1,100));
+ //qDebug() << "Drop Item:" << it->whatsThis();
+ QFileInfo info(it->whatsThis());
if(info.isDir() && info.isWritable()){
dirpath = info.absoluteFilePath();
}
@@ -118,11 +125,13 @@ protected:
foreach(const QUrl &url, ev->mimeData()->urls()){
const QString filepath = url.toLocalFile();
//If the target file is modifiable, assume a move - otherwise copy
- if(QFileInfo(filepath).isWritable() && (filepath.startsWith(home) && dirpath.startsWith(home))){ files << "cut::::"+filepath; }
- else{ files << "copy::::"+filepath; }
+ if(QFileInfo(filepath).isWritable() && (filepath.startsWith(home) && dirpath.startsWith(home))){
+ if(filepath.section("/",0,-2)!=dirpath){ files << "cut::::"+filepath; } //don't "cut" a file into the same dir
+ }else{ files << "copy::::"+filepath; }
}
- //qDebug() << "Drop Event:" << dirpath;
- emit DataDropped( dirpath, files );
+ //qDebug() << "Drop Event:" << dirpath << files;
+ if(!files.isEmpty()){ emit DataDropped( dirpath, files ); }
+ this->setCursor(Qt::ArrowCursor);
}
void mouseReleaseEvent(QMouseEvent *ev){
@@ -175,7 +184,7 @@ protected:
if(items.length()<1){ return; }
QList<QUrl> urilist;
for(int i=0; i<items.length(); i++){
- urilist << QUrl::fromLocalFile(items[i]->whatsThis(0).section("::::",1,100));
+ urilist << QUrl::fromLocalFile(items[i]->whatsThis(0));
}
//Create the mime data
QMimeData *mime = new QMimeData;
@@ -218,7 +227,7 @@ protected:
//See if the item under the drop point is a directory or not
QTreeWidgetItem *it = this->itemAt( ev->pos());
if(it!=0){
- QFileInfo info(it->whatsThis(0).section("::::",1,100));
+ QFileInfo info(it->whatsThis(0));
if(info.isDir() && info.isWritable()){
dirpath = info.absoluteFilePath();
}
@@ -229,9 +238,10 @@ protected:
QString home = QDir::homePath();
foreach(const QUrl &url, ev->mimeData()->urls()){
const QString filepath = url.toLocalFile();
- //If the target file is modifiable, assume a move - otherwise copy
- if(QFileInfo(filepath).isWritable() && (filepath.startsWith(home) && dirpath.startsWith(home)) ){ files << "cut::::"+filepath; }
- else{ files << "copy::::"+filepath; }
+ //If the target file is modifiable, assume a move - otherwise copy
+ if(QFileInfo(filepath).isWritable() && (filepath.startsWith(home) && dirpath.startsWith(home))){
+ if(filepath.section("/",0,-2)!=dirpath){ files << "cut::::"+filepath; } //don't "cut" a file into the same dir
+ }else{ files << "copy::::"+filepath; }
}
//qDebug() << "Drop Event:" << dirpath;
emit DataDropped( dirpath, files );
diff --git a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp b/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp
index f1037896..48ad6aa5 100644
--- a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp
+++ b/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp
@@ -19,11 +19,11 @@
#include <LuminaOS.h>
#include <LuminaXDG.h>
-#include <LuminaUtils.h>
+#include <LUtils.h>
#include "../ScrollDialog.h"
-#define DEBUG 1
+#define DEBUG 0
DirWidget::DirWidget(QString objID, QWidget *parent) : QWidget(parent), ui(new Ui::DirWidget){
ui->setupUi(this); //load the designer file
@@ -87,7 +87,7 @@ void DirWidget::cleanup(){
void DirWidget::ChangeDir(QString dirpath){
//stopload = true; //just in case it is still loading
//emit LoadDirectory(ID, dirpath);
- qDebug() << "ChangeDir:" << dirpath;
+ //qDebug() << "ChangeDir:" << dirpath;
currentBrowser()->changeDirectory(dirpath);
}
@@ -100,7 +100,7 @@ QString DirWidget::id(){
}
QString DirWidget::currentDir(){
- return currentBrowser()->currentDirectory();
+ return currentBrowser()->currentDirectory();
}
void DirWidget::setShowDetails(bool show){
@@ -126,7 +126,7 @@ void DirWidget::setThumbnailSize(int px){
void DirWidget::LoadSnaps(QString basedir, QStringList snaps){
//Save these value internally for use later
- qDebug() << "ZFS Snapshots available:" << basedir << snaps;
+ //qDebug() << "ZFS Snapshots available:" << basedir << snaps;
snapbasedir = basedir;
snapshots = snaps;
//if(!snapbasedir.isEmpty()){ watcher->addPath(snapbasedir); } //add this to the watcher in case snapshots get created/removed
@@ -387,7 +387,7 @@ void DirWidget::dir_changed(){
QString dir = line_dir->text().simplified();
//Run the dir through the user-input checks
dir = LUtils::PathToAbsolute(dir);
- //qDebug() << "Dir:" << dir;
+ //qDebug() << "Dir Changed:" << dir;
//Quick check to ensure the directory exists
while(!QFile::exists(dir) && !dir.isEmpty()){
dir = dir.section("/",0,-2); //back up one additional dir
@@ -477,7 +477,7 @@ void DirWidget::OpenContextMenu(){
void DirWidget::UpdateContextMenu(){
//First generate the context menu based on the selection
- qDebug() << "Update context menu";
+ //qDebug() << "Update context menu";
QStringList sel = currentBrowser()->currentSelection();
contextMenu->clear();
@@ -504,15 +504,18 @@ void DirWidget::currentDirectoryChanged(bool widgetonly){
QFileInfo info(cur);
canmodify = info.isWritable();
if(widgetonly){ ui->label_status->setText(currentBrowser()->status()); }
- else{ ui->label_status->setText(tr("Loading...")); }
+ else if( !currentBrowser()->isEnabled() ){ ui->label_status->setText(tr("Loading...")); }
//qDebug() << "Start search for snapshots";
- if(!cur.contains("/.zfs/snapshot")){
+ if(!cur.contains("/.zfs/snapshot") ){
normalbasedir = cur;
ui->group_snaps->setVisible(false);
emit findSnaps(ID, cur);
+ qDebug() << "Changed to directory:" << cur;
}else{
//Re-assemble the normalbasedir variable (in case moving around within a snapshot)
- normalbasedir = cur.replace( QRegExp("/\\.zfs/snapshot/(.)+/"), "/" );
+ normalbasedir = cur;
+ normalbasedir.replace( QRegExp("\\/\\.zfs\\/snapshot/([^/]+)\\/"), "/" );
+ qDebug() << "Changed to snapshot:" << cur << normalbasedir;
}
ui->actionBack->setEnabled( currentBrowser()->history().length()>1 );
line_dir->setText(normalbasedir);
@@ -525,6 +528,7 @@ void DirWidget::dirStatusChanged(QString stat){
}
void DirWidget::setCurrentBrowser(QString id){
+ //qDebug() << "Set Current Browser:" << id;
if(id==cBID){ return; } //no change
cBID = id;
currentDirectoryChanged(true); //update all the averarching widget elements (widget only)
@@ -545,7 +549,7 @@ void DirWidget::createNewFile(){
&ok, 0, Qt::ImhFormattedNumbersOnly | Qt::ImhUppercaseOnly | Qt::ImhLowercaseOnly);
if(!ok || newdocument.isEmpty()){ return; }
//Create the empty file
- QString full = BW->currentDirectory();
+ QString full = currentBrowser()->currentDirectory();
if(!full.endsWith("/")){ full.append("/"); }
//verify the new file does not already exist
if(QFile::exists(full+newdocument)){
@@ -570,7 +574,7 @@ void DirWidget::createNewDir(){
&ok, 0, Qt::ImhFormattedNumbersOnly | Qt::ImhUppercaseOnly | Qt::ImhLowercaseOnly);
if(!ok || newdir.isEmpty()){ return; }
//Now create the new dir
- QString full = BW->currentDirectory();
+ QString full = currentBrowser()->currentDirectory();
if(!full.endsWith("/")){ full.append("/"); }
QDir dir(full); //open the current dir
full.append(newdir); //append the new name to the current dir
@@ -594,7 +598,7 @@ void DirWidget::createNewXDGEntry(){
if(!ok || newdocument.isEmpty()){ return; }
if(!newdocument.endsWith(".desktop")){ newdocument.append(".desktop"); }
//Create the empty file
- QString full = BW->currentDirectory();
+ QString full = currentBrowser()->currentDirectory();
if(!full.endsWith("/")){ full.append("/"); }
//Verify the file does not already exist
if(QFile::exists(full+newdocument)){
bgstack15