diff options
author | Weblate <noreply@weblate.org> | 2016-10-03 18:08:13 +0000 |
---|---|---|
committer | Weblate <noreply@weblate.org> | 2016-10-03 18:08:13 +0000 |
commit | 5601c621c2aa70e6f748cbe73fccbcc81de6792b (patch) | |
tree | f549ee5c4266ad553bd250a1fc45340d92c801db /src-qt5 | |
parent | Translated using Weblate (l_TERMINAL@ja (generated)) (diff) | |
parent | Fix the bytes to display function in the case where the number of bytes *exac... (diff) | |
download | lumina-5601c621c2aa70e6f748cbe73fccbcc81de6792b.tar.gz lumina-5601c621c2aa70e6f748cbe73fccbcc81de6792b.tar.bz2 lumina-5601c621c2aa70e6f748cbe73fccbcc81de6792b.zip |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'src-qt5')
4 files changed, 63 insertions, 28 deletions
diff --git a/src-qt5/core-utils/lumina-config/pages/page_autostart.cpp b/src-qt5/core-utils/lumina-config/pages/page_autostart.cpp index 371791e9..0159d8f5 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_autostart.cpp +++ b/src-qt5/core-utils/lumina-config/pages/page_autostart.cpp @@ -32,7 +32,9 @@ page_autostart::~page_autostart(){ // PUBLIC SLOTS //================ void page_autostart::SaveSettings(){ + //qDebug() << "Load AutoStart Files for saving"; QList<XDGDesktop*> STARTAPPS = LXDG::findAutoStartFiles(true); //also want invalid/disabled items + //qDebug() << " - done"; //bool newstartapps = false; for(int i=0; i<ui->list_session_start->count(); i++){ QString file = ui->list_session_start->item(i)->whatsThis(); @@ -57,17 +59,19 @@ void page_autostart::SaveSettings(){ } } //end loop over GUI items //Now cleanup all the STARTAPPS data - for(int i=0; STARTAPPS.length(); i++){ STARTAPPS[i]->deleteLater(); } + for(int i=STARTAPPS.length()-1; i>=0; i--){ STARTAPPS[i]->deleteLater(); } } void page_autostart::LoadSettings(int){ emit HasPendingChanges(false); emit ChangePageTitle( tr("Startup Services") ); + //qDebug() << "Load AutoStart Files"; QList<XDGDesktop*> STARTAPPS = LXDG::findAutoStartFiles(true); //also want invalid/disabled items + //qDebug() << " - done:" << STARTAPPS.length(); //qDebug() << "StartApps:"; ui->list_session_start->clear(); for(int i=0; i<STARTAPPS.length(); i++){ - //qDebug() << STARTAPPS[i].filePath +" -> " +STARTAPPS[i].name << STARTAPPS[i].isHidden; + //qDebug() << STARTAPPS[i]->filePath +" -> " +STARTAPPS[i]->name << STARTAPPS[i]->isHidden; if( !STARTAPPS[i]->isValid() || !QFile::exists(STARTAPPS[i]->filePath) ){ continue; } QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon(STARTAPPS[i]->icon,"application-x-executable"), STARTAPPS[i]->name ); it->setWhatsThis(STARTAPPS[i]->filePath); //keep the file location @@ -77,7 +81,7 @@ void page_autostart::LoadSettings(int){ ui->list_session_start->addItem(it); } //Now cleanup all the STARTAPPS data - for(int i=0; STARTAPPS.length(); i++){ STARTAPPS[i]->deleteLater(); } + for(int i=STARTAPPS.length()-1; i>=0; i--){ STARTAPPS[i]->deleteLater(); } } void page_autostart::updateIcons(){ diff --git a/src-qt5/core/libLumina/LuminaUtils.cpp b/src-qt5/core/libLumina/LuminaUtils.cpp index 8a35be6b..db165cf2 100644 --- a/src-qt5/core/libLumina/LuminaUtils.cpp +++ b/src-qt5/core/libLumina/LuminaUtils.cpp @@ -410,13 +410,14 @@ QString LUtils::BytesToDisplaySize(qint64 ibytes){ }else if(bytes>=10){ //need 1 decimel place num = QString::number( (qRound(bytes*10)/10.0) ); - }else if(bytes>1){ + }else if(bytes>=1){ //need 2 decimel places num = QString::number( (qRound(bytes*100)/100.0) ); }else{ //Fully decimel (3 places) num = "0."+QString::number(qRound(bytes*1000)); } + //qDebug() << "Bytes to Human-readable:" << bytes << c << num << labs[c]; return (num+labs[c]); } diff --git a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp b/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp index cc608b92..f1037896 100644 --- a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp +++ b/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp @@ -66,6 +66,7 @@ DirWidget::DirWidget(QString objID, QWidget *parent) : QWidget(parent), ui(new U UpdateIcons(); UpdateText(); + createShortcuts(); createMenus(); } @@ -188,34 +189,67 @@ void DirWidget::UpdateText(){ // ================= // PRIVATE // ================= +void DirWidget::createShortcuts(){ +kZoomIn= new QShortcut(QKeySequence(QKeySequence::ZoomIn),this); +kZoomOut= new QShortcut(QKeySequence(QKeySequence::ZoomOut),this); +kNewFile= new QShortcut(QKeySequence(Qt::CTRL+Qt::SHIFT+Qt::Key_F),this); +kNewDir= new QShortcut(QKeySequence(Qt::CTRL+Qt::SHIFT+Qt::Key_N),this); +kNewXDG= new QShortcut(QKeySequence(Qt::CTRL+Qt::Key_G),this); +kCut= new QShortcut(QKeySequence(QKeySequence::Cut),this); +kCopy= new QShortcut(QKeySequence(QKeySequence::Copy),this); +kPaste= new QShortcut(QKeySequence(QKeySequence::Paste),this); +kRename= new QShortcut(QKeySequence(Qt::Key_F2),this); +kFav= new QShortcut(QKeySequence(Qt::Key_F3),this); +kDel= new QShortcut(QKeySequence(QKeySequence::Delete),this); +kOpSS= new QShortcut(QKeySequence(Qt::Key_F6),this); +kOpMM= new QShortcut(QKeySequence(Qt::Key_F7),this); +kOpTerm = new QShortcut(QKeySequence(Qt::Key_F1),this); + +connect(kZoomIn, SIGNAL(activated()), this, SLOT(on_tool_zoom_in_clicked()) ); +connect(kZoomOut, SIGNAL(activated()), this, SLOT(on_tool_zoom_out_clicked()) ); +connect(kNewFile, SIGNAL(activated()), this, SLOT(createNewFile()) ); +connect(kNewDir, SIGNAL(activated()), this, SLOT(createNewDir()) ); +connect(kNewXDG, SIGNAL(activated()), this, SLOT(createNewXDGEntry()) ); +connect(kCut, SIGNAL(activated()), this, SLOT(cutFiles()) ); +connect(kCopy, SIGNAL(activated()), this, SLOT(copyFiles()) ); +connect(kPaste, SIGNAL(activated()), this, SLOT(pasteFiles()) ); +connect(kRename, SIGNAL(activated()), this, SLOT(renameFiles()) ); +connect(kFav, SIGNAL(activated()), this, SLOT(favoriteFiles()) ); +connect(kDel, SIGNAL(activated()), this, SLOT(removeFiles()) ); +connect(kOpSS, SIGNAL(activated()), this, SLOT(openInSlideshow()) ); +connect(kOpMM, SIGNAL(activated()), this, SLOT(openMultimedia()) ); +connect(kOpTerm, SIGNAL(activated()), this, SLOT(openTerminal()) ); + +} + void DirWidget::createMenus(){ //Note: contextMenu already created - this is just for the sub-items if(cNewMenu==0){ cNewMenu = new QMenu(this); } else{ cNewMenu->clear(); } cNewMenu->setTitle(tr("Create...") ); cNewMenu->setIcon( LXDG::findIcon("list-add","") ); - cNewMenu->addAction(LXDG::findIcon("document-new",""), tr("File"), this, SLOT(createNewFile()) ); - cNewMenu->addAction(LXDG::findIcon("folder-new",""), tr("Directory"), this, SLOT(createNewDir()) ); - if(LUtils::isValidBinary("lumina-fileinfo")){ cNewMenu->addAction(LXDG::findIcon("system-run",""), tr("Application Launcher"), this, SLOT(createNewXDGEntry()) ); } + cNewMenu->addAction(LXDG::findIcon("document-new",""), tr("File"), this, SLOT(createNewFile()), kNewFile->key() ); + cNewMenu->addAction(LXDG::findIcon("folder-new",""), tr("Directory"), this, SLOT(createNewDir()), kNewDir->key() ); + if(LUtils::isValidBinary("lumina-fileinfo")){ cNewMenu->addAction(LXDG::findIcon("system-run",""), tr("Application Launcher"), this, SLOT(createNewXDGEntry()), kNewXDG->key() ); } if(cOpenMenu==0){ cOpenMenu = new QMenu(this); } else{ cOpenMenu->clear(); } cOpenMenu->setTitle(tr("Launch...")); cOpenMenu->setIcon( LXDG::findIcon("quickopen","") ); - cOpenMenu->addAction(LXDG::findIcon("utilities-terminal",""), tr("Terminal"), this, SLOT(openTerminal())); - cOpenMenu->addAction(LXDG::findIcon("view-preview",""), tr("SlideShow"), this, SLOT(openInSlideshow())); - cOpenMenu->addAction(LXDG::findIcon("view-media-lyrics","media-playback-start"), tr("Multimedia Player"), this, SLOT(openMultimedia())); + cOpenMenu->addAction(LXDG::findIcon("utilities-terminal",""), tr("Terminal"), this, SLOT(openTerminal()), kOpTerm->key()); + cOpenMenu->addAction(LXDG::findIcon("view-preview",""), tr("SlideShow"), this, SLOT(openInSlideshow()), kOpSS->key()); + cOpenMenu->addAction(LXDG::findIcon("view-media-lyrics","media-playback-start"), tr("Multimedia Player"), this, SLOT(openMultimedia()), kOpMM->key()); if(cFModMenu==0){ cFModMenu = new QMenu(this); } else{ cFModMenu->clear(); } cFModMenu->setTitle(tr("Modify Files...")); cFModMenu->setIcon( LXDG::findIcon("document-edit","") ); - cFModMenu->addAction(LXDG::findIcon("edit-cut",""), tr("Cut Selection"), this, SLOT(cutFiles()) ); - cFModMenu->addAction(LXDG::findIcon("edit-copy",""), tr("Copy Selection"), this, SLOT(copyFiles()) ); + cFModMenu->addAction(LXDG::findIcon("edit-cut",""), tr("Cut Selection"), this, SLOT(cutFiles()), kCut->key() ); + cFModMenu->addAction(LXDG::findIcon("edit-copy",""), tr("Copy Selection"), this, SLOT(copyFiles()), kCopy->key() ); cFModMenu->addSeparator(); - cFModMenu->addAction(LXDG::findIcon("edit-rename",""), tr("Rename..."), this, SLOT(renameFiles()) ); + cFModMenu->addAction(LXDG::findIcon("edit-rename",""), tr("Rename..."), this, SLOT(renameFiles()), kRename->key() ); cFModMenu->addSeparator(); - cFModMenu->addAction(LXDG::findIcon("edit-delete",""), tr("Delete Selection"), this, SLOT(removeFiles()) ); + cFModMenu->addAction(LXDG::findIcon("edit-delete",""), tr("Delete Selection"), this, SLOT(removeFiles()), kDel->key() ); if(cFViewMenu==0){ cFViewMenu = new QMenu(this); } else{ cFViewMenu->clear(); } @@ -456,7 +490,7 @@ void DirWidget::UpdateContextMenu(){ cFModMenu->setEnabled(!sel.isEmpty() && canmodify); contextMenu->addMenu(cFViewMenu); cFViewMenu->setEnabled(!sel.isEmpty()); - contextMenu->addAction(LXDG::findIcon("edit-paste",""), tr("Paste"), this, SLOT(pasteFiles()) )->setEnabled(QApplication::clipboard()->mimeData()->hasFormat("x-special/lumina-copied-files") && canmodify); + contextMenu->addAction(LXDG::findIcon("edit-paste",""), tr("Paste"), this, SLOT(pasteFiles()), QKeySequence(Qt::CTRL+Qt::Key_V) )->setEnabled(QApplication::clipboard()->mimeData()->hasFormat("x-special/lumina-copied-files") && canmodify); //Now add the general selection options contextMenu->addSection(LXDG::findIcon("folder","inode/directory"), tr("Directory Operations")); if(canmodify){ @@ -578,7 +612,7 @@ void DirWidget::createNewXDGEntry(){ // - Selected FILE operations void DirWidget::cutFiles(){ QStringList sel = currentBrowser()->currentSelection(); - if(sel.isEmpty()){ return; } + if(sel.isEmpty() || !canmodify){ return; } emit CutFiles(sel); } @@ -589,12 +623,13 @@ void DirWidget::copyFiles(){ } void DirWidget::pasteFiles(){ + if( !canmodify ){ return; } emit PasteFiles(currentBrowser()->currentDirectory(), QStringList() ); } void DirWidget::renameFiles(){ QStringList sel = currentBrowser()->currentSelection(); - if(sel.isEmpty()){ return; } + if(sel.isEmpty() || !canmodify){ return; } qDebug() << "Deleting selected Items:" << sel; emit RenameFiles(sel); } @@ -607,7 +642,7 @@ void DirWidget::favoriteFiles(){ void DirWidget::removeFiles(){ QStringList sel = currentBrowser()->currentSelection(); - if(sel.isEmpty()){ return; } + if(sel.isEmpty() || !canmodify){ return; } qDebug() << "Deleting selected Items:" << sel; emit RemoveFiles(sel); } diff --git a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.h b/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.h index 6a9bdf79..38e7a657 100644 --- a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.h +++ b/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.h @@ -56,21 +56,11 @@ public slots: //Refresh options void refresh(); //Refresh current directory - //void refreshButtons(); //Refresh action buttons only //Theme change functions void UpdateIcons(); void UpdateText(); - - //Button updates - //void UpdateButtons(); - //Keyboard Shortcuts triggered - /*void TryRenameSelection(); - void TryCutSelection(); - void TryCopySelection(); - void TryPasteSelection(); - void TryDeleteSelection();*/ private: Ui::DirWidget *ui; @@ -87,7 +77,12 @@ private: //The context menu and associated items QMenu *contextMenu, *cNewMenu, *cOpenMenu, *cFModMenu, *cFViewMenu; + //The keyboard shortcuts for context menu items + QShortcut *kZoomIn, *kZoomOut, *kNewFile, *kNewDir, *kNewXDG, *kCut, *kCopy, *kPaste, *kRename, \ + *kFav, *kDel, *kOpSS, *kOpMM, *kOpTerm; + //Functions for internal use + void createShortcuts(); //on init only void createMenus(); //on init only BrowserWidget* currentBrowser(); |