aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/desktop-utils/lumina-fm
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5/desktop-utils/lumina-fm')
-rw-r--r--src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp12
-rw-r--r--src-qt5/desktop-utils/lumina-fm/BrowserWidget.h8
-rw-r--r--src-qt5/desktop-utils/lumina-fm/widgets/DDListWidgets.h2
3 files changed, 19 insertions, 3 deletions
diff --git a/src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp b/src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp
index fcbcdbed..51d633e4 100644
--- a/src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp
+++ b/src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp
@@ -33,6 +33,7 @@ BrowserWidget::BrowserWidget(QString objID, QWidget *parent) : QWidget(parent){
connect(this, SIGNAL(dirChange(QString, bool)), BROWSER, SLOT(loadDirectory(QString, bool)) );
listWidget = 0;
treeWidget = 0;
+ treeSortColumn = 0;
readDateFormat();
freshload = true; //nothing loaded yet
numItems = 0;
@@ -98,8 +99,10 @@ void BrowserWidget::showDetails(bool show){
connect(treeWidget, SIGNAL(customContextMenuRequested(const QPoint&)), this, SIGNAL(contextMenuRequested()) );
connect(treeWidget, SIGNAL(DataDropped(QString, QStringList)), this, SIGNAL(DataDropped(QString, QStringList)) );
connect(treeWidget, SIGNAL(GotFocus()), this, SLOT(selectionChanged()) );
+ connect(treeWidget, SIGNAL(sortColumnChanged(int)), this, SIGNAL(treeWidgetSortColumn(int)) );
+ connect(treeWidget, SIGNAL(sortColumnChanged(int)), this, SIGNAL(setTreeWidgetSortColumn(int)) );
retranslate();
- treeWidget->sortItems(0, Qt::AscendingOrder);
+ treeWidget->sortItems(treeSortColumn, Qt::AscendingOrder);
treeWidget->setColumnWidth(0, treeWidget->fontMetrics().width("W")*20);
if(!BROWSER->currentDirectory().isEmpty()){ emit dirChange("", true); }
}else if(!show && listWidget==0){
@@ -191,6 +194,13 @@ void BrowserWidget::setShowActive(bool show){
this->setStyleSheet(base);
}
+void BrowserWidget::setTreeWidgetSortColumn(int col, bool now){
+ treeSortColumn = col;
+ if(now && treeWidget!=0){
+ treeWidget->sortItems(treeSortColumn, Qt::AscendingOrder);
+ }
+}
+
// This function is only called if user changes sessionsettings. By doing so, operations like sorting by date
// are faster because the date format is already stored in DirWidget::date_format static variable
void BrowserWidget::readDateFormat() {
diff --git a/src-qt5/desktop-utils/lumina-fm/BrowserWidget.h b/src-qt5/desktop-utils/lumina-fm/BrowserWidget.h
index dc7c95c1..fbabd9c7 100644
--- a/src-qt5/desktop-utils/lumina-fm/BrowserWidget.h
+++ b/src-qt5/desktop-utils/lumina-fm/BrowserWidget.h
@@ -26,8 +26,9 @@ private:
int numItems; //used for checking if all the items have loaded yet
QString ID, statustip;
QStringList date_format, historyList;
- QMap<QString,QPair<QTreeWidgetItem*, LVideoWidget*>> videoMap;
+ QMap<QString,QPair<QTreeWidgetItem*, LVideoWidget*>> videoMap;
bool freshload;
+ int treeSortColumn;
//The drag and drop brower widgets
DDListWidget *listWidget;
@@ -61,6 +62,8 @@ public:
void setShowActive(bool show); //used for accenting if the widget is "active"
+ void setTreeWidgetSortColumn(int col, bool now = false);
+
QString status(){ return statustip; }
//Date format for show items
@@ -82,6 +85,7 @@ private slots:
void selectionChanged();
void loadStatistics(BrowserWidget *bw); //designed to be run in a background thread
+
protected:
void resizeEvent(QResizeEvent *ev);
@@ -96,6 +100,6 @@ signals:
//Internal signal
void dirChange(QString, bool); //current dir path, force
-
+ void treeWidgetSortColumn(int);
};
#endif
diff --git a/src-qt5/desktop-utils/lumina-fm/widgets/DDListWidgets.h b/src-qt5/desktop-utils/lumina-fm/widgets/DDListWidgets.h
index 7e4b1f22..ec7742c7 100644
--- a/src-qt5/desktop-utils/lumina-fm/widgets/DDListWidgets.h
+++ b/src-qt5/desktop-utils/lumina-fm/widgets/DDListWidgets.h
@@ -176,6 +176,7 @@ public:
signals:
void DataDropped(QString, QStringList); //Dir path, List of commands
void GotFocus();
+ void sortColumnChanged(int);
protected:
void focusInEvent(QFocusEvent *ev){
@@ -320,6 +321,7 @@ public:
// In other cases, we trust base class implementation
return QTreeWidgetItem::operator<(tmp);
}
+
};
//Item override for sorting purposes of list widget items
bgstack15