filebrowser/ui/src/fbmainwindow.cpp
changeset 51 b048e15729d6
parent 31 e7a04a6385be
equal deleted inserted replaced
44:5db69f4c3d06 51:b048e15729d6
    19 
    19 
    20 #include "fbmainwindow.h"
    20 #include "fbmainwindow.h"
    21 #include "enginewrapper.h"
    21 #include "enginewrapper.h"
    22 #include "fbfileview.h"
    22 #include "fbfileview.h"
    23 #include "fbdriveview.h"
    23 #include "fbdriveview.h"
    24 #include "settingsview.h"
    24 #include "fbsettingsview.h"
    25 #include "editorview.h"
    25 #include "fbeditorview.h"
    26 #include "searchview.h"
    26 #include "fbsearchview.h"
       
    27 #include "fbattributesview.h"
    27 
    28 
    28 FbMainWindow::FbMainWindow(QWidget *parent)
    29 FbMainWindow::FbMainWindow(QWidget *parent)
    29     : HbMainWindow(parent),
    30     : HbMainWindow(parent),
    30     mEngineWrapper(0),
    31     mEngineWrapper(0),
    31     mDriveView(0),
    32     mDriveView(0),
    32     mFileView(0),
    33     mFileView(0),
    33     mSettingsView(0),
    34     mSettingsView(0),
    34     mEditorView(0),
    35     mEditorView(0),
    35     mSearchView(0),
    36     mSearchView(0),
       
    37     mAttributesView(0),
    36     mPreviousView(0)
    38     mPreviousView(0)
    37 {
    39 {
    38 }
    40 }
    39 
    41 
    40 FbMainWindow::~FbMainWindow ()
    42 FbMainWindow::~FbMainWindow ()
    64     connect(mFileView, SIGNAL(aboutToShowDriveView()), this, SLOT(openDriveView()));
    66     connect(mFileView, SIGNAL(aboutToShowDriveView()), this, SLOT(openDriveView()));
    65     mFileView->init(mEngineWrapper);
    67     mFileView->init(mEngineWrapper);
    66     addView(mFileView);
    68     addView(mFileView);
    67 
    69 
    68     // Create settings view
    70     // Create settings view
    69     mSettingsView = new SettingsView(*mEngineWrapper);
    71     mSettingsView = new FbSettingsView(*mEngineWrapper);
    70     connect(mSettingsView, SIGNAL(finished(bool)), this, SLOT(openPreviousBrowserView()));
    72     connect(mSettingsView, SIGNAL(finished(bool)), this, SLOT(openPreviousBrowserView()));
    71     addView(mSettingsView);
    73     addView(mSettingsView);
    72 
    74 
    73     // Create editor view
    75     // Create editor view
    74     mEditorView = new EditorView();
    76     mEditorView = new FbEditorView();
    75     connect(mFileView, SIGNAL(aboutToShowEditorView(const QString &, bool)), this, SLOT(openEditorView(const QString &, bool)));
    77     connect(mFileView, SIGNAL(aboutToShowEditorView(const QString &, bool)), this, SLOT(openEditorView(const QString &, bool)));
    76     connect(mEditorView, SIGNAL(finished(bool)), this, SLOT(openFileView()));
    78     connect(mEditorView, SIGNAL(finished(bool)), this, SLOT(openFileView()));
    77     addView(mEditorView);
    79     addView(mEditorView);
    78 
    80 
    79     // Create Search view
    81     // Create Search view
    80     mSearchView = new SearchView(*mEngineWrapper);
    82     mSearchView = new FbSearchView(*mEngineWrapper);
    81     connect(mDriveView, SIGNAL(aboutToShowSearchView(QString)), this, SLOT(openSearchView(QString)));
    83     connect(mDriveView, SIGNAL(aboutToShowSearchView(QString)), this, SLOT(openSearchView(QString)));
    82     connect(mFileView, SIGNAL(aboutToShowSearchView(QString)), this, SLOT(openSearchView(QString)));
    84     connect(mFileView, SIGNAL(aboutToShowSearchView(QString)), this, SLOT(openSearchView(QString)));
    83     connect(mSearchView, SIGNAL(finished(bool)), this, SLOT(openFileBrowserView(bool)));
    85     connect(mSearchView, SIGNAL(finished(bool)), this, SLOT(openFileBrowserView(bool)));
    84     addView(mSearchView);
    86     addView(mSearchView);
       
    87 
       
    88     connect(mFileView, SIGNAL(aboutToShowAttributesView(const QString &, quint32 &, quint32 &, bool &)),
       
    89             this, SLOT(openAttributesView(const QString &, quint32 &, quint32 &, bool &)));
    85 
    90 
    86     // Show ApplicationView at startup
    91     // Show ApplicationView at startup
    87     setCurrentView(mDriveView);
    92     setCurrentView(mDriveView);
    88     mPreviousView = mDriveView;
    93     mPreviousView = mDriveView;
    89 
    94 
   141 void FbMainWindow::openSearchView(const QString &path)
   146 void FbMainWindow::openSearchView(const QString &path)
   142 {
   147 {
   143     mSearchView->open(path);
   148     mSearchView->open(path);
   144     setCurrentView(mSearchView);
   149     setCurrentView(mSearchView);
   145 }
   150 }
       
   151 
       
   152 void FbMainWindow::openAttributesView(const QString &attributesViewTitle,
       
   153                                       quint32 &setAttributesMask,
       
   154                                       quint32 &clearAttributesMask,
       
   155                                       bool &recurse)
       
   156 {
       
   157     if (!mAttributesView) {
       
   158         // Create attributes view
       
   159         mAttributesView = new FbAttributesView(setAttributesMask, clearAttributesMask, recurse);
       
   160         connect(mAttributesView, SIGNAL(finished(bool)), this, SLOT(closeAttributesView(bool)));
       
   161         mAttributesView->setTitle(attributesViewTitle);
       
   162         addView(mAttributesView);
       
   163         setCurrentView(mAttributesView);
       
   164     }
       
   165 }
       
   166 
       
   167 void FbMainWindow::closeAttributesView(bool accepted)
       
   168 {
       
   169     if (accepted) {
       
   170         mEngineWrapper->setAttributes(mAttributesView->setAttributesMask(), mAttributesView->clearAttributesMask(), mAttributesView->recurse());
       
   171     }
       
   172     openFileView();
       
   173     removeView(mAttributesView);
       
   174     mAttributesView->deleteLater();
       
   175     mAttributesView = 0;
       
   176 }
       
   177 
       
   178 // End of file