Changeset ba50b13


Ignore:
Timestamp:
06/24/14 08:57:51 (10 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, releng/10.0.3, releng/10.1, releng/10.1.1, releng/10.1.2
Children:
1506c22
Parents:
f9e3e5c
Message:

Get the lumina file manager ability to detect mounted external devices working completely, using the new LuminaOS class in libLumina.

Location:
lumina/lumina-fm
Files:
3 edited

Legend:

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

    rbb3f61c rba50b13  
    4444  setupConnections(); 
    4545  loadSettings(); 
     46  RebuildBookmarksMenu(); 
     47  RebuildDeviceMenu(); 
    4648  //Make sure we start on the browser page 
    4749  goToBrowserPage(); 
     
    8183  ui->actionBackToBrowser->setIcon( LXDG::findIcon("go-previous","") ); 
    8284  ui->actionManage_Bookmarks->setIcon( LXDG::findIcon("bookmarks-organize","") ); 
     85  ui->actionScan->setIcon( LXDG::findIcon("system-search","") ); 
     86         
    8387  //Browser page 
    8488  ui->tool_addToDir->setIcon( LXDG::findIcon("folder-new","") ); 
     
    106110  connect(ui->tree_dir_view, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(OpenContextMenu(const QPoint&)) ); 
    107111  connect(ui->menuBookmarks, SIGNAL(triggered(QAction*)), this, SLOT(goToBookmark(QAction*)) ); 
     112  connect(ui->menuExternal_Devices, SIGNAL(triggered(QAction*)), this, SLOT(goToDevice(QAction*)) ); 
    108113  connect(currentDir, SIGNAL(returnPressed()), this, SLOT(goToDirectory())); 
    109114         
     
    142147  // but before the first directory gets loaded 
    143148  ui->actionView_Hidden_Files->setChecked( settings->value("showhidden", false).toBool() ); 
    144    
     149} 
     150 
     151void MainUI::loadBrowseDir(QString dir){ 
     152  qDebug() << "Load Browse Dir:" << dir; 
     153} 
     154 
     155void MainUI::loadSnapshot(QString dir){ 
     156  qDebug() << "Load Snapshot:" << dir; 
     157} 
     158 
     159bool MainUI::findSnapshotDir(){ 
     160  qDebug() << "Find Snapshot Dir:"; 
     161  return false; 
     162} 
     163 
     164void MainUI::RebuildBookmarksMenu(){ 
    145165  //Create the bookmarks menu 
    146166  ui->menuBookmarks->clear(); 
     
    152172    ui->menuBookmarks->addSeparator(); 
    153173  bool changed = false; 
     174  BM.sort(); //Sort alphabetically 
    154175  for(int i=0; i<BM.length(); i++){ 
    155176    if(QFile::exists(BM[i].section("::::",1,1)) ){ 
     
    168189} 
    169190 
    170 void MainUI::loadBrowseDir(QString dir){ 
    171   qDebug() << "Load Browse Dir:" << dir; 
    172 } 
    173  
    174 void MainUI::loadSnapshot(QString dir){ 
    175   qDebug() << "Load Snapshot:" << dir; 
    176 } 
    177  
    178 bool MainUI::findSnapshotDir(){ 
    179   qDebug() << "Find Snapshot Dir:"; 
    180   return false; 
     191void MainUI::RebuildDeviceMenu(){ 
     192  //Create the External Devices Menu appropriately 
     193  ui->menuExternal_Devices->clear(); 
     194    ui->menuExternal_Devices->addAction( ui->actionScan ); 
     195    ui->menuExternal_Devices->addSeparator(); 
     196  //Scan for externally mounted devices 
     197  QStringList devs = LOS::ExternalDevicePaths(); 
     198    //Output Format: <type>::::<filesystem>::::<path>  (6/24/14 - version 0.4.0 ) 
     199        // <type> = [USB, HDRIVE, SDCARD, DVD, UNKNOWN] 
     200         
     201  //Now add them to the menu appropriately 
     202  for(int i=0; i<devs.length(); i++){ 
     203    QAction *act = new QAction(devs[i].section("::::",2,2).section("/",-1),this); 
     204        act->setWhatsThis(devs[i].section("::::",2,2)); //full path to mountpoint 
     205        act->setToolTip( QString(tr("Filesystem: %1")).arg( devs[i].section("::::",1,1) ) ); 
     206        //Now set the appropriate icon 
     207        QString type = devs[i].section("::::",0,0); 
     208        if(type=="USB"){ type = "drive-removable-media-usb"; } 
     209        else if(type=="HDRIVE"){ type = "drive-harddisk"; } 
     210        else if(type=="SDCARD"){ type = "media-flash-sd-mmc"; } 
     211        else if(type=="DVD"){ type = "media-optical"; } 
     212        else{ type = "drive-removable-media"; } 
     213        act->setIcon( LXDG::findIcon(type, "") ); 
     214      ui->menuExternal_Devices->addAction(act); 
     215  } 
    181216} 
    182217 
     
    222257  ui->actionBack->setEnabled(history.length() > 1); 
    223258  ui->actionBookMark->setEnabled( rawdir!=QDir::homePath() && settings->value("bookmarks", QStringList()).toStringList().filter("::::"+rawdir).length()<1 ); 
     259  RebuildDeviceMenu(); //keep this refreshed 
    224260} 
    225261 
     
    383419      dlg.loadSettings(settings); 
    384420      dlg.exec(); 
    385     loadSettings(); //rebuild bookmarks menu 
     421    RebuildBookmarksMenu(); 
     422  }else{ 
     423    setCurrentDir(act->whatsThis()); 
     424  } 
     425} 
     426 
     427void MainUI::goToDevice(QAction *act){ 
     428  if(act==ui->actionScan){ 
     429    RebuildDeviceMenu(); 
    386430  }else{ 
    387431    setCurrentDir(act->whatsThis()); 
  • lumina/lumina-fm/MainUI.h

    rbb3f61c rba50b13  
    2929// libLumina includes 
    3030#include <LuminaXDG.h> 
     31#include <LuminaOS.h> 
    3132 
    3233// Local includes 
     
    7172        bool findSnapshotDir(); //returns true if the current dir has snapshots available 
    7273         
     74        void RebuildBookmarksMenu(); 
     75        void RebuildDeviceMenu(); 
     76         
    7377        //Functions to get/set the currently active directory 
    7478        QString getCurrentDir(); 
     
    97101        void on_actionClose_triggered(); 
    98102        void goToBookmark(QAction*); 
     103        void goToDevice(QAction*); 
    99104         
    100105        //Toolbar Actions 
  • lumina/lumina-fm/MainUI.ui

    r603a75a rba50b13  
    9494              </property> 
    9595              <property name="shortcut"> 
    96                <string>Ctrl+K</string> 
     96               <string>Ctrl+S</string> 
    9797              </property> 
    9898              <property name="toolButtonStyle"> 
     
    679679  <action name="actionScan"> 
    680680   <property name="text"> 
    681     <string>Scan</string> 
     681    <string>Scan for Devices</string> 
    682682   </property> 
    683683  </action> 
Note: See TracChangeset for help on using the changeset viewer.