filebrowser/ui/src/fbdriveview.cpp
changeset 48 da3ec8478e66
parent 35 98924d2efce9
equal deleted inserted replaced
47:11fa016241a4 48:da3ec8478e66
    14 * Description:
    14 * Description:
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 #include "fbdriveview.h"
    18 #include "fbdriveview.h"
    19 #include "settingsview.h"
    19 #include "fbsettingsview.h"
    20 #include "editorview.h"
    20 #include "fbeditorview.h"
    21 #include "searchview.h"
    21 #include "fbsearchview.h"
    22 #include "enginewrapper.h"
    22 #include "enginewrapper.h"
    23 #include "notifications.h"
    23 #include "notifications.h"
    24 
    24 
    25 #include "fbdrivemodel.h"
    25 #include "fbdrivemodel.h"
    26 #include "filebrowsersortfilterproxymodel.h"
    26 #include "filebrowsersortfilterproxymodel.h"
   158   */
   158   */
   159 void FbDriveView::createFileMenu()
   159 void FbDriveView::createFileMenu()
   160 {
   160 {
   161     mOptionMenuActions.mFileMenu = menu()->addMenu("File");
   161     mOptionMenuActions.mFileMenu = menu()->addMenu("File");
   162 
   162 
   163 //    mOptionMenuActions.mFileOpenDrive = mOptionMenuActions.mFileMenu->addAction("Open drive", this, SLOT(fileOpenDrive()));
       
   164     mOptionMenuActions.mFileSearch = mOptionMenuActions.mFileMenu->addAction("Search...", this, SLOT(fileSearch()));
   163     mOptionMenuActions.mFileSearch = mOptionMenuActions.mFileMenu->addAction("Search...", this, SLOT(fileSearch()));
   165     //mOptionMenuActions.mFileSearch->setVisible(false);
   164     //mOptionMenuActions.mFileSearch->setVisible(false);
   166 
   165 
   167     //mOptionMenuActions.mFileNewMenu = mOptionMenuActions.mFileMenu->addMenu("New");
   166     //mOptionMenuActions.mFileNewMenu = mOptionMenuActions.mFileMenu->addMenu("New");
   168 
   167 
   309         showEditMenu = true;
   308         showEditMenu = true;
   310 
   309 
   311     mOptionMenuActions.mEditMenu->menuAction()->setVisible(showEditMenu);
   310     mOptionMenuActions.mEditMenu->menuAction()->setVisible(showEditMenu);
   312 
   311 
   313     //aMenuPane->SetItemDimmed(EFileBrowserCmdFileOpen, isFileItemListEmpty || isDriveListViewActive || isCurrentItemDirectory);
   312     //aMenuPane->SetItemDimmed(EFileBrowserCmdFileOpen, isFileItemListEmpty || isDriveListViewActive || isCurrentItemDirectory);
   314 //    mOptionMenuActions.mFileOpenDrive->setVisible( !(isFileItemListEmpty || !isDriveListViewActive));
       
   315 
   313 
   316     //aMenuPane->SetItemDimmed(EFileBrowserCmdFileView, isFileItemListEmpty || !hasSelectedItems || isCurrentItemDirectory || isDriveListViewActive);
   314     //aMenuPane->SetItemDimmed(EFileBrowserCmdFileView, isFileItemListEmpty || !hasSelectedItems || isCurrentItemDirectory || isDriveListViewActive);
   317     //aMenuPane->SetItemDimmed(EFileBrowserCmdFileEdit, isFileItemListEmpty || !hasSelectedItems || isCurrentItemDirectory || isDriveListViewActive);
   315     //aMenuPane->SetItemDimmed(EFileBrowserCmdFileEdit, isFileItemListEmpty || !hasSelectedItems || isCurrentItemDirectory || isDriveListViewActive);
   318     //aMenuPane->SetItemDimmed(EFileBrowserCmdFileSendTo, isFileItemListEmpty || driveListActive || isCurrentItemDirectory);
   316     //aMenuPane->SetItemDimmed(EFileBrowserCmdFileSendTo, isFileItemListEmpty || driveListActive || isCurrentItemDirectory);
   319 
   317 
   573     QString searchPath;
   571     QString searchPath;
   574     HbAction *contextrMenuAction = static_cast<HbAction *>(sender());
   572     HbAction *contextrMenuAction = static_cast<HbAction *>(sender());
   575     if (contextrMenuAction
   573     if (contextrMenuAction
   576         && contextrMenuAction->text().compare(QString("Search..."), Qt::CaseInsensitive) == 0
   574         && contextrMenuAction->text().compare(QString("Search..."), Qt::CaseInsensitive) == 0
   577         && contextrMenuAction == mContextMenuActions.mFileSearch) {
   575         && contextrMenuAction == mContextMenuActions.mFileSearch) {
   578         DriveEntry driveEntry(mEngineWrapper->getDriveEntry(currentItemIndex()));
   576         FbDriveEntry driveEntry(mEngineWrapper->getDriveEntry(currentItemIndex()));
   579         searchPath = driveEntry.driveLetter() + QString(":\\");
   577         searchPath = driveEntry.driveLetter() + QString(":\\");
   580     } else {
   578     } else {
   581         searchPath = mEngineWrapper->currentPath();
   579         searchPath = mEngineWrapper->currentPath();
   582     }
   580     }
   583     emit aboutToShowSearchView(searchPath);
   581     emit aboutToShowSearchView(searchPath);
   629 {
   627 {
   630     QModelIndex currentIndex = currentItemIndex();
   628     QModelIndex currentIndex = currentItemIndex();
   631     // check if the drive has a password
   629     // check if the drive has a password
   632     if (mEngineWrapper->hasDrivePassword(currentIndex)) {
   630     if (mEngineWrapper->hasDrivePassword(currentIndex)) {
   633         QString heading = QString("Existing password");
   631         QString heading = QString("Existing password");
   634         HbInputDialog::getText(heading, this, SLOT(diskAdminSetDrivePasswordNew(HbAction*)), QString(), scene());
   632         HbInputDialog::queryText(heading, this, SLOT(diskAdminSetDrivePasswordNew(HbAction*)), QString(), scene());
   635     } else {
   633     } else {
   636         QString heading = QString("New password");
   634         QString heading = QString("New password");
   637         HbInputDialog::getText(heading, this, SLOT(doDiskAdminSetDrivePassword(HbAction*)), mOldPassword, scene());
   635         HbInputDialog::queryText(heading, this, SLOT(doDiskAdminSetDrivePassword(HbAction*)), mOldPassword, scene());
   638     }
   636     }
   639 }
   637 }
   640 
   638 
   641 /**
   639 /**
   642    Open new password for the selected drive dialog.
   640    Open new password for the selected drive dialog.
   645 {
   643 {
   646     HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
   644     HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
   647     if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) {
   645     if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) {
   648         mOldPassword = dlg->value().toString();
   646         mOldPassword = dlg->value().toString();
   649         QString heading = QString("New password");
   647         QString heading = QString("New password");
   650         HbInputDialog::getText(heading, this, SLOT(doDiskAdminSetDrivePassword(HbAction*)), mOldPassword, scene());
   648         HbInputDialog::queryText(heading, this, SLOT(doDiskAdminSetDrivePassword(HbAction*)), mOldPassword, scene());
   651     }
   649     }
   652 }
   650 }
   653 
   651 
   654 /**
   652 /**
   655    Set password for the selected drive.
   653    Set password for the selected drive.
   674 {
   672 {
   675     QModelIndex currentIndex = currentItemIndex();
   673     QModelIndex currentIndex = currentItemIndex();
   676     // check if the drive is locked
   674     // check if the drive is locked
   677     if (mEngineWrapper->isDriveLocked(currentIndex)) {
   675     if (mEngineWrapper->isDriveLocked(currentIndex)) {
   678         QString heading = QString("Existing password");
   676         QString heading = QString("Existing password");
   679         HbInputDialog::getText(heading, this, SLOT(doDiskAdminUnlockDrive(HbAction*)), QString(), scene());
   677         HbInputDialog::queryText(heading, this, SLOT(doDiskAdminUnlockDrive(HbAction*)), QString(), scene());
   680     } else {
   678     } else {
   681         Notifications::showInformationNote(QString("This drive is not locked"));
   679         Notifications::showInformationNote(QString("This drive is not locked"));
   682     }
   680     }
   683 }
   681 }
   684 
   682 
   703 {
   701 {
   704     QModelIndex currentIndex = currentItemIndex();
   702     QModelIndex currentIndex = currentItemIndex();
   705     // check if the drive has a password
   703     // check if the drive has a password
   706     if (mEngineWrapper->hasDrivePassword(currentIndex)) {
   704     if (mEngineWrapper->hasDrivePassword(currentIndex)) {
   707         QString heading = QString("Existing password");
   705         QString heading = QString("Existing password");
   708         HbInputDialog::getText(heading, this, SLOT(doDiskAdminClearDrivePassword(HbAction*)), QString(), scene());
   706         HbInputDialog::queryText(heading, this, SLOT(doDiskAdminClearDrivePassword(HbAction*)), QString(), scene());
   709     } else {
   707     } else {
   710         Notifications::showInformationNote(QString("This drive has no password"));
   708         Notifications::showInformationNote(QString("This drive has no password"));
   711     }
   709     }
   712 }
   710 }
   713 
   711 
   732 void FbDriveView::diskAdminEraseDrivePassword()
   730 void FbDriveView::diskAdminEraseDrivePassword()
   733 {
   731 {
   734     // check if the drive has a password
   732     // check if the drive has a password
   735     QModelIndex currentIndex = currentItemIndex();
   733     QModelIndex currentIndex = currentItemIndex();
   736     if (mEngineWrapper->hasDrivePassword(currentIndex)) {
   734     if (mEngineWrapper->hasDrivePassword(currentIndex)) {
   737         HbMessageBox::question(QString("Are you sure? All data can be lost!"), this, SLOT(doDiskAdminEraseDrivePassword(HbAction*)));
   735         HbMessageBox::question(QString("Are you sure? All data can be lost!"),
       
   736                                this,
       
   737                                SLOT(doDiskAdminEraseDrivePassword(int)),
       
   738                                HbMessageBox::Yes | HbMessageBox::No);
   738     } else {
   739     } else {
   739         Notifications::showInformationNote(QString("This drive has no password"));
   740         Notifications::showInformationNote(QString("This drive has no password"));
   740     }
   741     }
   741 }
   742 }
   742 
   743 
   743 /**
   744 /**
   744   Erase password of the selected drive
   745   Erase password of the selected drive
   745   */
   746   */
   746 void FbDriveView::doDiskAdminEraseDrivePassword(HbAction* action)
   747 void FbDriveView::doDiskAdminEraseDrivePassword(int action)
   747 {
   748 {
   748     if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) {
   749     if (action == HbMessageBox::Yes) {
   749         QModelIndex currentIndex = currentItemIndex();
   750         QModelIndex currentIndex = currentItemIndex();
   750         mEngineWrapper->DiskAdminEraseDrivePassword(currentIndex);
   751         mEngineWrapper->DiskAdminEraseDrivePassword(currentIndex);
   751         refreshList();
   752         refreshList();
   752     }
   753     }
   753 }
   754 }
   755 /**
   756 /**
   756   Performs format on the selected drive
   757   Performs format on the selected drive
   757   */
   758   */
   758 void FbDriveView::diskAdminFormatDrive()
   759 void FbDriveView::diskAdminFormatDrive()
   759 {
   760 {
   760     HbMessageBox::question(QString("Are you sure? All data will be lost!"), this, SLOT(doDiskAdminFormatDrive(HbAction*)));
   761     HbMessageBox::question(QString("Are you sure? All data will be lost!"),
       
   762                            this,
       
   763                            SLOT(doDiskAdminFormatDrive(int)),
       
   764                            HbMessageBox::Yes | HbMessageBox::No);
   761 }
   765 }
   762 
   766 
   763 /**
   767 /**
   764   Performs format on the selected drive
   768   Performs format on the selected drive
   765   */
   769   */
   766 void FbDriveView::doDiskAdminFormatDrive(HbAction* action)
   770 void FbDriveView::doDiskAdminFormatDrive(int action)
   767 {
   771 {
   768     if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) {
   772     if (action == HbMessageBox::Yes) {
   769         QModelIndex currentIndex = currentItemIndex();
   773         QModelIndex currentIndex = currentItemIndex();
   770         mEngineWrapper->DiskAdminFormatDrive(currentIndex, false);
   774         mEngineWrapper->DiskAdminFormatDrive(currentIndex, false);
   771     }
   775     }
   772 }
   776 }
   773 
   777 
   774 /**
   778 /**
   775   Performs quick format on the selected drive
   779   Performs quick format on the selected drive
   776   */
   780   */
   777 void FbDriveView::diskAdminQuickFormatDrive()
   781 void FbDriveView::diskAdminQuickFormatDrive()
   778 {
   782 {
   779     HbMessageBox::question(QString("Are you sure? All data will be lost!"), this, SLOT(doDiskAdminQuickFormatDrive(HbAction*)));
   783     HbMessageBox::question(QString("Are you sure? All data will be lost!"),
       
   784                            this,
       
   785                            SLOT(doDiskAdminQuickFormatDrive(int)),
       
   786                            HbMessageBox::Yes | HbMessageBox::No);
   780 }
   787 }
   781 
   788 
   782 /**
   789 /**
   783   Performs quick format on the selected drive
   790   Performs quick format on the selected drive
   784   */
   791   */
   785 void FbDriveView::doDiskAdminQuickFormatDrive(HbAction* action)
   792 void FbDriveView::doDiskAdminQuickFormatDrive(int action)
   786 {
   793 {
   787     if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) {
   794     if (action == HbMessageBox::Yes) {
   788         QModelIndex currentIndex = currentItemIndex();
   795         QModelIndex currentIndex = currentItemIndex();
   789         mEngineWrapper->DiskAdminFormatDrive(currentIndex, true);
   796         mEngineWrapper->DiskAdminFormatDrive(currentIndex, true);
   790     }
   797     }
   791 }
   798 }
   792 
   799 
   802 /**
   809 /**
   803   Checks the selected drive for errors and corrects them
   810   Checks the selected drive for errors and corrects them
   804   */
   811   */
   805 void FbDriveView::diskAdminScanDrive()
   812 void FbDriveView::diskAdminScanDrive()
   806 {
   813 {
   807     HbMessageBox::question(QString("This finds errors on disk and corrects them. Proceed?"), this, SLOT(doDiskAdminScanDrive(HbAction*)));
   814     HbMessageBox::question(QString("This finds errors on disk and corrects them. Proceed?"),
       
   815                            this,
       
   816                            SLOT(doDiskAdminScanDrive(int)),
       
   817                            HbMessageBox::Yes | HbMessageBox::No);
   808 }
   818 }
   809 
   819 
   810 /**
   820 /**
   811   Checks the selected drive for errors and corrects them
   821   Checks the selected drive for errors and corrects them
   812   */
   822   */
   813 void FbDriveView::doDiskAdminScanDrive(HbAction* action)
   823 void FbDriveView::doDiskAdminScanDrive(int action)
   814 {
   824 {
   815     if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) {
   825     if (action == HbMessageBox::Yes) {
   816         QModelIndex currentIndex = currentItemIndex();
   826         QModelIndex currentIndex = currentItemIndex();
   817         mEngineWrapper->DiskAdminScanDrive(currentIndex);
   827         mEngineWrapper->DiskAdminScanDrive(currentIndex);
   818         refreshList();
   828         refreshList();
   819     }
   829     }
   820 }
   830 }
   829     // get existing drive name
   839     // get existing drive name
   830     QModelIndex currentIndex = currentItemIndex();
   840     QModelIndex currentIndex = currentItemIndex();
   831     mEngineWrapper->GetDriveName(currentIndex, driveName);
   841     mEngineWrapper->GetDriveName(currentIndex, driveName);
   832 
   842 
   833     QString heading = QString("New name");
   843     QString heading = QString("New name");
   834     HbInputDialog::getText(heading, this, SLOT(doDiskAdminSetDriveName(HbAction*)), driveName, scene());
   844     HbInputDialog::queryText(heading, this, SLOT(doDiskAdminSetDriveName(HbAction*)), driveName, scene());
   835 }
   845 }
   836 
   846 
   837 /**
   847 /**
   838   Set drive name.
   848   Set drive name.
   839   */
   849   */
   860     // get existing drive name
   870     // get existing drive name
   861     QModelIndex currentIndex = currentItemIndex();
   871     QModelIndex currentIndex = currentItemIndex();
   862     mEngineWrapper->GetDriveVolumeLabel(currentIndex, volumeLabel);
   872     mEngineWrapper->GetDriveVolumeLabel(currentIndex, volumeLabel);
   863 
   873 
   864     QString heading = QString("New volume label");
   874     QString heading = QString("New volume label");
   865     HbInputDialog::getText(heading, this, SLOT(doDiskAdminSetDriveVolumeLabel(HbAction*)), volumeLabel, scene());
   875     HbInputDialog::queryText(heading, this, SLOT(doDiskAdminSetDriveVolumeLabel(HbAction*)), volumeLabel, scene());
   866 }
   876 }
   867 
   877 
   868 /**
   878 /**
   869   Set drive volume label.
   879   Set drive volume label.
   870   */
   880   */
   894 /**
   904 /**
   895   Dismount the selected drive
   905   Dismount the selected drive
   896   */
   906   */
   897 void FbDriveView::diskAdminDismountDrive()
   907 void FbDriveView::diskAdminDismountDrive()
   898 {
   908 {
   899     HbMessageBox::question(QString("Are you sure you know what are you doing?"), this, SLOT(doDiskAdminDismountDrive(HbAction*)));
   909     HbMessageBox::question(QString("Are you sure you know what are you doing?"),
   900 }
   910                            this,
   901 
   911                            SLOT(doDiskAdminDismountDrive(int)),
   902 void FbDriveView::doDiskAdminDismountDrive(HbAction* action)
   912                            HbMessageBox::Yes | HbMessageBox::No);
   903 {
   913 }
   904     if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) {
   914 
       
   915 void FbDriveView::doDiskAdminDismountDrive(int action)
       
   916 {
       
   917     if (action == HbMessageBox::Yes) {
   905         QModelIndex currentIndex = currentItemIndex();
   918         QModelIndex currentIndex = currentItemIndex();
   906         mEngineWrapper->DiskAdminDismountDrive(currentIndex);
   919         mEngineWrapper->DiskAdminDismountDrive(currentIndex);
   907         refreshList();
   920         refreshList();
   908     }
   921     }
   909 }
   922 }
   912   Erase Master Boot Record of the selected drive
   925   Erase Master Boot Record of the selected drive
   913   */
   926   */
   914 void FbDriveView::diskAdminEraseMBR()
   927 void FbDriveView::diskAdminEraseMBR()
   915 {
   928 {
   916     // TODO What to do with FB LITE macros?
   929     // TODO What to do with FB LITE macros?
   917     HbMessageBox::question(QString("Are you sure? Your media driver must support this!"), this, SLOT(doDiskAdminEraseMBR(HbAction*)));
   930     HbMessageBox::question(QString("Are you sure? Your media driver must support this!"),
   918 }
   931                            this,
   919 
   932                            SLOT(doDiskAdminEraseMBR(int)),
   920 void FbDriveView::doDiskAdminEraseMBR(HbAction* action)
   933                            HbMessageBox::Yes | HbMessageBox::No);
       
   934 }
       
   935 
       
   936 void FbDriveView::doDiskAdminEraseMBR(int action)
   921 {
   937 {
   922     // TODO What to do with FB LITE macros?
   938     // TODO What to do with FB LITE macros?
   923     if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) {
   939     if (action == HbMessageBox::Yes) {
   924         HbMessageBox::question(QString("Are you really sure you know what are you doing ?!?"), this, SLOT(doDiskAdminReallyEraseMBR(HbAction*)));
   940         HbMessageBox::question(QString("Are you really sure you know what are you doing ?!?"),
   925     }
   941                                this,
   926 }
   942                                SLOT(doDiskAdminReallyEraseMBR(int)),
   927 
   943                                HbMessageBox::Yes | HbMessageBox::No);
   928 void FbDriveView::doDiskAdminReallyEraseMBR(HbAction* action)
   944     }
   929 {
   945 }
   930     if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) {
   946 
       
   947 void FbDriveView::doDiskAdminReallyEraseMBR(int action)
       
   948 {
       
   949     if (action == HbMessageBox::Yes) {
   931         QModelIndex currentIndex = currentItemIndex();
   950         QModelIndex currentIndex = currentItemIndex();
   932         // warn if the selected drive is not detected as removable
   951         // warn if the selected drive is not detected as removable
   933         if (mEngineWrapper->isDriveRemovable(currentIndex)) {
   952         if (mEngineWrapper->isDriveRemovable(currentIndex)) {
   934             mEngineWrapper->DiskAdminEraseMBR(currentIndex);
   953             mEngineWrapper->DiskAdminEraseMBR(currentIndex);
   935             refreshList();
   954             refreshList();
   936         } else {
   955         } else {
   937             HbMessageBox::question(QString("Selected drive is not removable, really continue?"), this, SLOT(doDiskAdminNotRemovableReallyEraseMBR(HbAction*)));
   956             HbMessageBox::question(QString("Selected drive is not removable, really continue?"),
       
   957                                    this,
       
   958                                    SLOT(doDiskAdminNotRemovableReallyEraseMBR(int)),
       
   959                                    HbMessageBox::Yes | HbMessageBox::No);
   938         }
   960         }
   939     }
   961     }
   940 }
   962 }
   941 
   963 
   942 void FbDriveView::doDiskAdminNotRemovableReallyEraseMBR(HbAction* action)
   964 void FbDriveView::doDiskAdminNotRemovableReallyEraseMBR(int action)
   943 {
   965 {
   944     if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) {
   966     if (action == HbMessageBox::Yes) {
   945         QModelIndex currentIndex = currentItemIndex();
   967         QModelIndex currentIndex = currentItemIndex();
   946         mEngineWrapper->DiskAdminEraseMBR(currentIndex);
   968         mEngineWrapper->DiskAdminEraseMBR(currentIndex);
   947         refreshList();
   969         refreshList();
   948     }
   970     }
   949 
   971 
   952 /**
   974 /**
   953   Partition the selected drive
   975   Partition the selected drive
   954   */
   976   */
   955 void FbDriveView::diskAdminPartitionDrive()
   977 void FbDriveView::diskAdminPartitionDrive()
   956 {
   978 {
   957     const QString message("Are you sure? Your media driver must support this!");
   979     HbMessageBox::question(QString("Are you sure? Your media driver must support this!"),
   958     HbMessageBox::question(message, this, SLOT(diskAdminPartitionDriveProceed(HbAction *)));
   980                            this,
       
   981                            SLOT(diskAdminPartitionDriveProceed(int)),
       
   982                            HbMessageBox::Yes | HbMessageBox::No);
   959 }
   983 }
   960 
   984 
   961 /**
   985 /**
   962   Partition the selected drive if user is sure
   986   Partition the selected drive if user is sure
   963   */
   987   */
   964 void FbDriveView::diskAdminPartitionDriveProceed(HbAction *action)
   988 void FbDriveView::diskAdminPartitionDriveProceed(int action)
   965 {
   989 {
   966     if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) {
   990     if (action == HbMessageBox::Yes) {
   967         const QString message("Are you really sure you know what are you doing ?!?");
   991         HbMessageBox::question(QString("Are you really sure you know what are you doing ?!?"),
   968         HbMessageBox::question(message, this, SLOT(diskAdminPartitionDriveReallyProceed(HbAction *)));
   992                                this,
       
   993                                SLOT(diskAdminPartitionDriveReallyProceed(int)),
       
   994                                HbMessageBox::Yes | HbMessageBox::No);
   969     }
   995     }
   970 }
   996 }
   971 
   997 
   972 /**
   998 /**
   973   Partition the selected drive if user is really sure
   999   Partition the selected drive if user is really sure
   974   */
  1000   */
   975 void FbDriveView::diskAdminPartitionDriveReallyProceed(HbAction *action)
  1001 void FbDriveView::diskAdminPartitionDriveReallyProceed(int action)
   976 {
  1002 {
   977     if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) {
  1003     if (action == HbMessageBox::Yes) {
   978         QModelIndex currentIndex = currentItemIndex();
  1004         QModelIndex currentIndex = currentItemIndex();
   979         mEraseMBR = false;
  1005         mEraseMBR = false;
   980         // warn if the selected drive is not detected as removable
  1006         // warn if the selected drive is not detected as removable
   981         mProceed = false;
  1007         mProceed = false;
   982         if (mEngineWrapper->isDriveRemovable(currentIndex)) {
  1008         if (mEngineWrapper->isDriveRemovable(currentIndex)) {
   983             mProceed = true;
  1009             mProceed = true;
   984         } else {
  1010         } else {
   985             const QString message("Selected drive is not removable, really continue?");
  1011             HbMessageBox::question(QString("Selected drive is not removable, really continue?"),
   986             HbMessageBox::question(message, this, SLOT(diskAdminPartitionDriveIsNotRemovable(HbAction *)));
  1012                                    this,
       
  1013                                    SLOT(diskAdminPartitionDriveIsNotRemovable(int)),
       
  1014                                    HbMessageBox::Yes | HbMessageBox::No);
   987         }
  1015         }
   988 
  1016 
   989         if (mProceed) {
  1017         if (mProceed) {
   990             // query if erase mbr
  1018             // query if erase mbr
   991             mEraseMBR = false;
  1019             mEraseMBR = false;
   992 
  1020 
   993             QString message("Erase MBR first (normally needed)?");
  1021             HbMessageBox::question(QString("Erase MBR first (normally needed)?"),
   994             HbMessageBox::question(message, this, SLOT(diskAdminPartitionDriveEraseMbr(HbAction *)));
  1022                                    this,
       
  1023                                    SLOT(diskAdminPartitionDriveEraseMbr(int)),
       
  1024                                    HbMessageBox::Yes | HbMessageBox::No);
   995 
  1025 
   996             // TODO use HbListDialog
  1026             // TODO use HbListDialog
   997             QStringList list;
  1027             QStringList list;
   998             list << "1" << "2" << "3" << "4";
  1028             list << "1" << "2" << "3" << "4";
   999             openListDialog(list, QString("Partitions?"), this, SLOT(diskAdminPartitionDriveGetCount(HbAction*)));
  1029             openListDialog(list, QString("Partitions?"), this, SLOT(diskAdminPartitionDriveGetCount(HbAction*)));
  1002 }
  1032 }
  1003 
  1033 
  1004 /**
  1034 /**
  1005   Store result of user query about proceeding when drive is not removable.
  1035   Store result of user query about proceeding when drive is not removable.
  1006   */
  1036   */
  1007 void FbDriveView::diskAdminPartitionDriveIsNotRemovable(HbAction *action)
  1037 void FbDriveView::diskAdminPartitionDriveIsNotRemovable(int action)
  1008 {
  1038 {
  1009     if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) {
  1039     if (action == HbMessageBox::Yes) {
  1010         mProceed = true;
  1040         mProceed = true;
  1011     } else {
  1041     } else {
  1012         mProceed = false;
  1042         mProceed = false;
  1013     }
  1043     }
  1014 }
  1044 }
  1015 
  1045 
  1016 /**
  1046 /**
  1017   Store result of user query about erase MBR
  1047   Store result of user query about erase MBR
  1018   */
  1048   */
  1019 void FbDriveView::diskAdminPartitionDriveEraseMbr(HbAction *action)
  1049 void FbDriveView::diskAdminPartitionDriveEraseMbr(int action)
  1020 {
  1050 {
  1021     if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) {
  1051     if (action == HbMessageBox::Yes) {
  1022         mEraseMBR = true;
  1052         mEraseMBR = true;
  1023     }
  1053     }
  1024 }
  1054 }
  1025 
  1055 
  1026 /**
  1056 /**
  1093   */
  1123   */
  1094 void FbDriveView::toolsErrorSimulateLeave()
  1124 void FbDriveView::toolsErrorSimulateLeave()
  1095 {
  1125 {
  1096     int leaveCode = -6;
  1126     int leaveCode = -6;
  1097     QString heading = QString("Leave code");
  1127     QString heading = QString("Leave code");
  1098     //HbInputDialog::getInteger(heading, this, SLOT(doToolsErrorSimulateLeave(HbAction*)), leaveCode, scene());
  1128     HbInputDialog::queryText(heading, this, SLOT(doToolsErrorSimulateLeave(HbAction*)), QString::number(leaveCode), scene());
  1099     HbInputDialog::getText(heading, this, SLOT(doToolsErrorSimulateLeave(HbAction*)), QString::number(leaveCode), scene());
       
  1100 }
  1129 }
  1101 
  1130 
  1102 
  1131 
  1103 /**
  1132 /**
  1104   Simulate leave.
  1133   Simulate leave.
  1120   */
  1149   */
  1121 void FbDriveView::toolsErrorSimulatePanic()
  1150 void FbDriveView::toolsErrorSimulatePanic()
  1122 {
  1151 {
  1123     mPanicCategory = QString ("Test Category");
  1152     mPanicCategory = QString ("Test Category");
  1124     QString heading = QString("Panic category");
  1153     QString heading = QString("Panic category");
  1125     HbInputDialog::getText(heading, this, SLOT(doToolsErrorSimulatePanicCode(HbAction*)), mPanicCategory, scene());
  1154     HbInputDialog::queryText(heading, this, SLOT(doToolsErrorSimulatePanicCode(HbAction*)), mPanicCategory, scene());
  1126 }
  1155 }
  1127 
  1156 
  1128 /**
  1157 /**
  1129   Simulate panic.
  1158   Simulate panic.
  1130   */
  1159   */
  1133     HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
  1162     HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
  1134     if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) {
  1163     if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) {
  1135         mPanicCategory = dlg->value().toString();
  1164         mPanicCategory = dlg->value().toString();
  1136         int panicCode(555);
  1165         int panicCode(555);
  1137         QString heading = QString("Panic code");
  1166         QString heading = QString("Panic code");
  1138         HbInputDialog::getInteger(heading, this, SLOT(doToolsErrorSimulatePanic(HbAction*)), panicCode, scene());
  1167         HbInputDialog::queryInt(heading, this, SLOT(doToolsErrorSimulatePanic(HbAction*)), panicCode, scene());
  1139     }
  1168     }
  1140 }
  1169 }
  1141 
  1170 
  1142 /**
  1171 /**
  1143   Simulate panic.
  1172   Simulate panic.
  1159   */
  1188   */
  1160 void FbDriveView::toolsErrorSimulateException()
  1189 void FbDriveView::toolsErrorSimulateException()
  1161 {
  1190 {
  1162     int exceptionCode = 0;
  1191     int exceptionCode = 0;
  1163     QString heading = QString("Exception code");
  1192     QString heading = QString("Exception code");
  1164     HbInputDialog::getInteger(heading, this, SLOT(doToolsErrorSimulateException(HbAction*)), exceptionCode, scene());
  1193     HbInputDialog::queryInt(heading, this, SLOT(doToolsErrorSimulateException(HbAction*)), exceptionCode, scene());
  1165 }
  1194 }
  1166 
  1195 
  1167 /**
  1196 /**
  1168   Simulate exception.
  1197   Simulate exception.
  1169   */
  1198   */
  1230 void FbDriveView::toolsSetDebugMaskQuestion()
  1259 void FbDriveView::toolsSetDebugMaskQuestion()
  1231 {
  1260 {
  1232     quint32 dbgMask = mEngineWrapper->getDebugMask();
  1261     quint32 dbgMask = mEngineWrapper->getDebugMask();
  1233     QString dbgMaskText = QString("0x").append(QString::number(dbgMask, 16));
  1262     QString dbgMaskText = QString("0x").append(QString::number(dbgMask, 16));
  1234     QString heading = QString("Kernel debug mask in hex format");
  1263     QString heading = QString("Kernel debug mask in hex format");
  1235     HbInputDialog::getText(heading, this, SLOT(toolsSetDebugMask(HbAction*)), dbgMaskText, scene());
  1264     HbInputDialog::queryText(heading, this, SLOT(toolsSetDebugMask(HbAction*)), dbgMaskText, scene());
  1236 }
  1265 }
  1237 
  1266 
  1238 /**
  1267 /**
  1239   Set debug mask
  1268   Set debug mask
  1240   */
  1269   */