Changeset 92c92a5


Ignore:
Timestamp:
06/25/14 17:22:46 (4 weeks ago)
Author:
Ken Moore <ken@…>
Branches:
master
Children:
97e7022, fc81347
Parents:
143a31e
Message:

Another small list of tweaks for lumina-fm, such as adding keyboard shortcuts for copy/paste/delete.

Location:
lumina/lumina-fm
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • lumina/lumina-fm/MainUI.cpp

    r143a31e r92c92a5  
    4040  nextTabRShort = new QShortcut( QKeySequence(tr("Shift+Right")), this); 
    4141  closeTabShort = new QShortcut( QKeySequence(tr("Ctrl+W")), this); 
     42  copyFilesShort = new QShortcut( QKeySequence(tr("Ctrl+C")), this); 
     43  pasteFilesShort = new QShortcut( QKeySequence(tr("Ctrl+V")), this); 
     44  deleteFilesShort = new QShortcut( QKeySequence(tr("Delete")), this); 
    4245  //Finish loading the interface 
    4346  setupIcons(); 
     
    140143  connect(nextTabRShort, SIGNAL(activated()), this, SLOT( nextTab() ) ); 
    141144  connect(closeTabShort, SIGNAL(activated()), this, SLOT( tabClosed() ) ); 
     145  connect(copyFilesShort, SIGNAL(activated()), this, SLOT( CopyItems() ) ); 
     146  connect(pasteFilesShort, SIGNAL(activated()), this, SLOT( PasteItems() ) ); 
     147  connect(deleteFilesShort, SIGNAL(activated()), this, SLOT( RemoveItem() ) ); 
    142148} 
    143149 
     
    146152  // but before the first directory gets loaded 
    147153  ui->actionView_Hidden_Files->setChecked( settings->value("showhidden", false).toBool() ); 
     154  on_actionView_Hidden_Files_triggered(); //make sure to update the models too 
    148155} 
    149156 
     
    233240  } //do nothing 
    234241  //qDebug() << "Show Directory:" << dir; 
    235   ui->tree_dir_view->setEnabled(false); //disable while loading 
    236   ui->label_dir_stats->setText(tr("Loading Directory...")); 
    237242  isUserWritable = info.isWritable(); 
    238243  if(dir.endsWith("/") && dir!="/" ){ dir.chop(1); } 
    239   currentDir->setWhatsThis(dir); //save the full path internally 
    240244  QString rawdir = dir; 
     245  //dir.replace(QDir::homePath()+"/", "~/"); 
     246  currentDir->setText(dir);   
    241247  //Update the directory viewer and update the line edit 
    242   ui->tree_dir_view->setRootIndex( fsmod->setRootPath(dir) ); 
    243   //dir.replace(QDir::homePath()+"/", "~/"); 
    244   currentDir->setText(dir); 
     248  if(dir!=currentDir->whatsThis()){ 
     249    currentDir->setWhatsThis(dir); //save the full path internally 
     250    ui->tree_dir_view->setEnabled(false); //disable while loading 
     251    ui->label_dir_stats->setText(tr("Loading Directory...")); 
     252    ui->tree_dir_view->setRootIndex( fsmod->setRootPath(dir) ); 
     253  } 
    245254  //Adjust the tab data 
    246255  tabBar->setTabWhatsThis( tabBar->currentIndex(), rawdir ); 
     
    255264  QTimer::singleShot(0, this, SLOT(checkForBackups())); 
    256265  QTimer::singleShot(0, this, SLOT(checkForPictures())); 
     266  ui->tool_addToDir->setEnabled(isUserWritable); 
    257267  ui->actionUpDir->setEnabled(dir!="/"); 
    258268  ui->actionBack->setEnabled(history.length() > 1); 
     
    316326  if(!pics.isEmpty()){ 
    317327    ui->combo_image_name->clear(); 
    318     ui->combo_image_name->addItems(pics); 
     328    for(int i=0; i<pics.length(); i++){ 
     329      ui->combo_image_name->addItem(QIcon(dir.absoluteFilePath(pics[i])), pics[i]); 
     330    } 
    319331    ui->tool_goToImages->setVisible(true);         
    320332  } 
     
    413425  qDebug() << "Closing Down..."; 
    414426  this->close(); 
     427} 
     428 
     429void MainUI::on_actionView_Hidden_Files_triggered(){ 
     430  if(ui->actionView_Hidden_Files->isChecked()){ 
     431    fsmod->setFilter( QDir::AllEntries | QDir::NoDotAndDotDot | QDir::AllDirs | QDir::Hidden ); 
     432    snapmod->setFilter( QDir::AllEntries | QDir::NoDotAndDotDot | QDir::AllDirs | QDir::Hidden ); 
     433  }else{ 
     434    fsmod->setFilter( QDir::AllEntries | QDir::NoDotAndDotDot | QDir::AllDirs ); 
     435    snapmod->setFilter( QDir::AllEntries | QDir::NoDotAndDotDot | QDir::AllDirs ); 
     436  } 
     437  //Now save this setting for later 
     438  settings->setValue("showhidden", ui->actionView_Hidden_Files->isChecked()); 
    415439} 
    416440 
     
    701725 
    702726void MainUI::RemoveItem(){ 
     727  //Only let this run if viewing the browser page 
     728  if(ui->stackedWidget->currentWidget()!=ui->page_browser){ return; } 
    703729   if(!isUserWritable){ 
    704730     QMessageBox::warning(this, tr("Invalid Permissions"), tr("You do not have permission to edit the files in this directory!") ); 
     
    729755 
    730756void MainUI::RenameItem(){ 
     757  //Only let this run if viewing the browser page 
     758  if(ui->stackedWidget->currentWidget()!=ui->page_browser){ return; } 
    731759  if(!CItem.isValid()){ return; } 
    732760  QString fname = fsmod->filePath(CItem); 
     
    762790 
    763791void MainUI::CutItems(){ 
     792  //Only let this run if viewing the browser page 
     793  if(ui->stackedWidget->currentWidget()!=ui->page_browser){ return; } 
    764794  //Get all the selected Items  
    765795  QStringList sel; 
     
    785815 
    786816void MainUI::CopyItems(){ 
     817  //Only let this run if viewing the browser page 
     818  if(ui->stackedWidget->currentWidget()!=ui->page_browser){ return; } 
    787819  //Get all the selected Items  
    788820  QStringList sel; 
     
    807839 
    808840void MainUI::PasteItems(){ 
     841  //Only let this run if viewing the browser page 
     842  if(ui->stackedWidget->currentWidget()!=ui->page_browser){ return; } 
    809843  const QMimeData *dat = QApplication::clipboard()->mimeData(); 
    810844  if(!dat->hasFormat("x-special/lumina-copied-files")){ return; } //nothing to paste 
     
    853887         
    854888} 
    855  
    856 void MainUI::RunInMediaPlayer(){ //open in the media player 
    857          
    858 } 
    859 void MainUI::RunInSlideShow(){ //open in slideshow viewer 
    860          
    861 } 
  • lumina/lumina-fm/MainUI.h

    r48743e0 r92c92a5  
    6161        QModelIndex CItem; //the item that was right-clicked (for the context menu) 
    6262        QSettings *settings; 
    63         QShortcut *nextTabLShort, *nextTabRShort, *closeTabShort; 
     63        QShortcut *nextTabLShort, *nextTabRShort, *closeTabShort, *copyFilesShort, *pasteFilesShort, *deleteFilesShort; 
    6464        QCompleter *dirCompleter; 
    6565        bool isUserWritable; 
     
    102102        void on_actionNew_Tab_triggered(); 
    103103        void on_actionClose_triggered(); 
     104        void on_actionView_Hidden_Files_triggered(); 
    104105        void goToBookmark(QAction*); 
    105106        void goToDevice(QAction*); 
     
    148149        void CopyItems(); 
    149150        void PasteItems(); 
    150          // - optional launching actions 
    151         void RunInMediaPlayer(); //open in the media player 
    152         void RunInSlideShow(); //open in slideshow viewer 
     151 
    153152}; 
    154153 
  • lumina/lumina-fm/MainUI.ui

    r143a31e r92c92a5  
    648648   </property> 
    649649   <property name="text"> 
    650     <string>View Hidden Files</string> 
     650    <string>Show Hidden Files</string> 
    651651   </property> 
    652652  </action> 
Note: See TracChangeset for help on using the changeset viewer.