# HG changeset patch # User hgs # Date 1273774248 -10800 # Node ID 31fc1277642eaadef5250b4da02d1ae89af864f7 # Parent 6053b7ae82ab583801ce26beaaa325a9dde85b04 201017_2 diff -r 6053b7ae82ab -r 31fc1277642e creator/inc/notifications.h --- a/creator/inc/notifications.h Thu May 13 20:59:38 2010 +0300 +++ b/creator/inc/notifications.h Thu May 13 21:10:48 2010 +0300 @@ -31,7 +31,11 @@ Q_OBJECT public: - + /** + * shows massage box + */ + static void showMessageBox(HbMessageBox::MessageBoxType type, const QString &text, const QString &label, int timeout ); + /** * shows about box */ diff -r 6053b7ae82ab -r 31fc1277642e creator/src/notifications.cpp --- a/creator/src/notifications.cpp Thu May 13 20:59:38 2010 +0300 +++ b/creator/src/notifications.cpp Thu May 13 21:10:48 2010 +0300 @@ -31,38 +31,48 @@ #include "notifications.h" +// --------------------------------------------------------------------------- +void Notifications::showMessageBox(HbMessageBox::MessageBoxType type, const QString &text, const QString &label, int timeout ) +{ + HbMessageBox *messageBox = new HbMessageBox(type); + messageBox->setText(text); + if(label.length()) + { + HbLabel *header = new HbLabel(label, messageBox); + messageBox->setHeadingWidget(header); + } + messageBox->setAttribute(Qt::WA_DeleteOnClose); + messageBox->setTimeout(timeout); + messageBox->open(); +} // --------------------------------------------------------------------------- void Notifications::about() { - HbMessageBox *messageBox = new HbMessageBox(HbMessageBox::MessageTypeInformation); - messageBox->setText("Version 6.0.0 - April 23rd 2010. Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. Licensed under Eclipse Public License v1.0."); - HbLabel *header = new HbLabel("About Creator", messageBox); - messageBox->setHeadingWidget(header); - messageBox->setAttribute(Qt::WA_DeleteOnClose); - messageBox->setTimeout(HbPopup::NoTimeout); - messageBox->open(); + showMessageBox(HbMessageBox::MessageTypeInformation, + "Version 6.0.0 - April 23rd 2010. Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. Licensed under Eclipse Public License v1.0.", + "About Creator", + HbPopup::NoTimeout + ); } // --------------------------------------------------------------------------- void Notifications::error(const QString& errorMessage) { - HbMessageBox::warning(errorMessage, new HbLabel("Error")); + showMessageBox(HbMessageBox::MessageTypeWarning, errorMessage, QString("Error"), 3000); } // --------------------------------------------------------------------------- - HbProgressDialog* Notifications::showProgressBar(const QString& text, int max) { HbProgressDialog *note = new HbProgressDialog(HbProgressDialog::ProgressDialog); note->setText(text); note->setMaximum(max); - note->show(); return note; @@ -70,12 +80,9 @@ // --------------------------------------------------------------------------- -void Notifications::showGlobalNote(const QString& text, HbMessageBox::MessageBoxType type, HbPopup::DefaultTimeout /*timeout*/) +void Notifications::showGlobalNote(const QString& text, HbMessageBox::MessageBoxType type, HbPopup::DefaultTimeout timeout) { - if (type == HbMessageBox::HbMessageBox::MessageTypeInformation) - HbMessageBox::information(text, new HbLabel("Information")); - else - HbMessageBox::information(text, new HbLabel("Information")); + showMessageBox(type, text, QString("Creator"), timeout); } // --------------------------------------------------------------------------- @@ -115,13 +122,14 @@ popup->setSecondaryAction(actionCancel); // Launch popup syncronously - HbAction *action = 0; - action = popup->exec(); + popup->setAttribute(Qt::WA_DeleteOnClose); + // TODO: handle dialog close & user input + popup->open(); // continue if ok selected and valid user input exists in line editor - if (action && action->text() == "Ok" && edit->text() != "") { + /*if (action && action->text() == "Ok" && edit->text() != "") { numberOfEntries = edit->text().toInt(&err, 10); - } + }*/ return err; } @@ -155,14 +163,15 @@ popup->setSecondaryAction(actionCancel); // Launch popup syncronously - HbAction *action = 0; - action = popup->exec(); + popup->setAttribute(Qt::WA_DeleteOnClose); + // TODO: handle dialog close & user input + popup->open(); // continue if ok selected and valid user input exists in line editor - if (action && action->text() == "Ok" && edit->text() != "") { + /*if (action && action->text() == "Ok" && edit->text() != "") { date = QDate::fromString(edit->text()); err = true; - } + }*/ return err; } @@ -170,7 +179,8 @@ bool Notifications::yesNoQueryDialog(const QString& text) { - return HbMessageBox::question(text); + HbMessageBox::question(text, 0, 0); + return false; } // --------------------------------------------------------------------------- @@ -210,14 +220,15 @@ popup->setSecondaryAction(actionCancel); // Launch popup syncronously - HbAction *action = 0; - action = popup->exec(); + popup->setAttribute(Qt::WA_DeleteOnClose); + // TODO: handle dialog close & user input + popup->open(); // continue if ok selected and valid user input exists in line editor - if (action && action->text() == "Ok" && edit->text() != "") { + /*if (action && action->text() == "Ok" && edit->text() != "") { directory = edit->text(); err = true; - } + }*/ return err; } diff -r 6053b7ae82ab -r 31fc1277642e filebrowser/ui/inc/enginewrapper.h --- a/filebrowser/ui/inc/enginewrapper.h Thu May 13 20:59:38 2010 +0300 +++ b/filebrowser/ui/inc/enginewrapper.h Thu May 13 21:10:48 2010 +0300 @@ -18,16 +18,17 @@ #ifndef ENGINEWRAPPER_H #define ENGINEWRAPPER_H +#include "driveentry.h" +#include "fileentry.h" +#include "filebrowsersettings.h" + +#include "engine.h" +#include "FBFileUtils.h" +#include "FB.hrh" + #include #include #include -#include -#include -#include - -#include "filebrowsersettings.h" - -#include class CEngine; class SearchAttributes; @@ -75,9 +76,7 @@ public: // from MFileBrowserUI /* Functions that are called from engine: */ -// TInt QueryCurrentItemIndex(); - - void ShowInformationNote(const TDesC& aDescText); + void ShowInformationNote(const TDesC &aDescText, const TDesC &aDescTitle); void ShowErrorNote(const TDesC& aDescText, TBool aNoTimeout = EFalse); void ShowConfirmationNote(const TDesC& aDescText, TBool aNoTimeout = EFalse); TBool ShowConfirmationQuery(const TDesC& aDescText); @@ -159,6 +158,8 @@ quint32 getDebugMask(); void toolsSetDebugMask(quint32 aDbgMask); + void showFileCheckSums(const QModelIndex &aIndex, TFileBrowserCmdFileChecksums checksumType); + private: // FB engine CEngine *mEngine; diff -r 6053b7ae82ab -r 31fc1277642e filebrowser/ui/inc/filebrowserview.h --- a/filebrowser/ui/inc/filebrowserview.h Thu May 13 20:59:38 2010 +0300 +++ b/filebrowser/ui/inc/filebrowserview.h Thu May 13 21:10:48 2010 +0300 @@ -18,12 +18,13 @@ #ifndef FILEBROWSERVIEWH_H_ #define FILEBROWSERVIEWH_H_ -#include -#include -#include #include "menuaction.h" #include "enginewrapper.h" +#include +#include +#include + #include // Forward declarations @@ -66,8 +67,7 @@ public slots: private: - void fileOpenDialog(const QString &fileName); - OverwriteOptions fileOverwriteDialog(); + void fileOverwriteDialog(); void openListDialog(const QStringList& items, const QString &aTitleText, QObject* receiver, const char* member); void diskAdmin(int cmd); @@ -76,10 +76,10 @@ const QString &primaryActionText, const QString &secondaryActionText); - HbDialog *openTextQuery(const QString &headingText, - const QString &text, - const QString &primaryActionText, - const QString &secondaryActionText); +// HbDialog *openTextQuery(const QString &headingText, +// const QString &text, +// const QString &primaryActionText, +// const QString &secondaryActionText); HbDialog *openNumberQuery(const QString &headingText, const QString &text, @@ -109,23 +109,36 @@ void refreshList(); void populateFolderContent(); -private slots: // option menu slots +private slots: // menu action slots // file menu void fileBackMoveUp(); void fileOpenDrive(); void fileOpenDirectory(); void fileSearch(); + void fileNewFile(); void doFileNewFile(HbAction *); + void fileNewDirectory(); void doFileNewDirectory(HbAction *); + void fileDelete(); void doFileDelete(HbAction *); + void fileRename(); + void doFileRename(HbAction *); + void doFileRenameFileExist(HbAction *); + void fileTouch(); void doFileTouch(HbAction *); void fileProperties(); + + void fileChecksumsMD5(); + void fileChecksumsMD2(); + void fileChecksumsSHA1(); + void fileChecksums(TFileBrowserCmdFileChecksums checksumType); + void fileSetAttributes(); // edit menu @@ -133,10 +146,13 @@ void editCut(); void editCopy(); void editPaste(); + void editCopyToFolder(); void doEditCopyToFolder(HbAction *); + void editMoveToFolder(); void doEditMoveToFolder(HbAction *); + void editSelect(); void editUnselect(); void editSelectAll(); @@ -180,13 +196,18 @@ void diskAdminEjectDrive(); void diskAdminDismountDrive(); void doDiskAdminDismountDrive(HbAction *); + void diskAdminEraseMBR(); void doDiskAdminEraseMBR(HbAction *); void doDiskAdminReallyEraseMBR(HbAction *); void doDiskAdminNotRemovableReallyEraseMBR(HbAction *); + void diskAdminPartitionDrive(); + void diskAdminPartitionDriveProceed(HbAction *); + void diskAdminPartitionDriveReallyProceed(HbAction *); + void diskAdminPartitionDriveIsNotRemovable(HbAction *); + void diskAdminPartitionDriveEraseMbr(HbAction *); void diskAdminPartitionDriveGetCount(HbAction*); - void diskAdminPartitionDrive(); // tools menu void toolsAllAppsToTextFile(); @@ -242,6 +263,10 @@ void activateSelectionMode(); void deActivateSelectionMode(); + void fileOpen(HbAction *); + void fileOverwrite(HbAction *); + void fileOverwritePostfix(HbAction *); + private: FileBrowserMainWindow &mMainWindow; EngineWrapper *mEngineWrapper; @@ -262,8 +287,6 @@ MenuAction mFileViewMenuActions; HbAction *mToolbarBackAction; - // editor - EditorView *mEditor; // search SearchView *mSearch; // settings @@ -275,10 +298,16 @@ bool mRemoveFileAfterCopied; bool mClipBoardInUse; bool mFolderContentChanged; - bool mEraseMBR; - // temporarily stored old passwird + + // temporarily storage QString mOldPassword; QString mPanicCategory; + QString mAbsoluteFilePath; + OverwriteOptions mOverwriteOptions; + QModelIndex mModelIndex; + bool mIsRenameAllowed; + bool mProceed; + bool mEraseMBR; }; diff -r 6053b7ae82ab -r 31fc1277642e filebrowser/ui/inc/notifications.h --- a/filebrowser/ui/inc/notifications.h Thu May 13 20:59:38 2010 +0300 +++ b/filebrowser/ui/inc/notifications.h Thu May 13 21:10:48 2010 +0300 @@ -22,33 +22,20 @@ #include class Notifications - { +{ public: - /** - * shows about box - */ - static void about(); + static void showAboutNote(); static void showMessageBox(HbMessageBox::MessageBoxType type, const QString &text, const QString &label, int timeout = HbPopup::NoTimeout); - static void showInformationNote(const QString &text); + static void showInformationNote(const QString &text, const QString &title = QString()); static void showErrorNote(const QString &text, bool noTimeout = false); static void showConfirmationNote(const QString &text, bool noTimeout = false); static bool showConfirmationQuery(const QString &aText); -// /** -// * shows progressbar -// */ + // static HbDeviceProgressDialog* showWaitDialog(const QString &text); - -private: - -// /** -// * shows global HbGlobalCommonNote type note -// */ -// static void showGlobalNote(const QString& text, HbCommonNote::NoteType type); - - }; - +private: +}; #endif // NOTIFICATIONS_H_ diff -r 6053b7ae82ab -r 31fc1277642e filebrowser/ui/src/enginewrapper.cpp --- a/filebrowser/ui/src/enginewrapper.cpp Thu May 13 20:59:38 2010 +0300 +++ b/filebrowser/ui/src/enginewrapper.cpp Thu May 13 21:10:48 2010 +0300 @@ -686,6 +686,11 @@ mEngine->FileUtils()->SetDebugMaskL(aDbgMask); } +void EngineWrapper::showFileCheckSums(const QModelIndex &aIndex, TFileBrowserCmdFileChecksums checksumType) +{ + mEngine->FileUtils()->ShowFileCheckSumsL(aIndex.row(), checksumType); +} + // --------------------------------------------------------------------------- // Functions that are called from engine // --------------------------------------------------------------------------- @@ -700,10 +705,11 @@ // --------------------------------------------------------------------------- -void EngineWrapper::ShowInformationNote(const TDesC& aDescText) +void EngineWrapper::ShowInformationNote(const TDesC &aDescText, const TDesC &aDescTitle) { - QString qStringText = QString::fromUtf16(aDescText.Ptr(), aDescText.Length()); - Notifications::showInformationNote(qStringText); + QString qText = QString::fromUtf16(aDescText.Ptr(), aDescText.Length()); + QString qTitle = QString::fromUtf16(aDescTitle.Ptr(), aDescTitle.Length()); + Notifications::showInformationNote(qText, qTitle); } // --------------------------------------------------------------------------- diff -r 6053b7ae82ab -r 31fc1277642e filebrowser/ui/src/filebrowserview.cpp --- a/filebrowser/ui/src/filebrowserview.cpp Thu May 13 20:59:38 2010 +0300 +++ b/filebrowser/ui/src/filebrowserview.cpp Thu May 13 21:10:48 2010 +0300 @@ -67,7 +67,6 @@ mFileBrowserModel(0), mFileViewMenuActions(), mToolbarBackAction(0), - mEditor(0), mSearch(0), mSettingsView(0), mItemHighlighted(false), @@ -75,6 +74,12 @@ mRemoveFileAfterCopied(false), mClipBoardInUse(false), mFolderContentChanged(false), + mOldPassword(), + mPanicCategory(), + mAbsoluteFilePath(), + mOverwriteOptions(), + mIsRenameAllowed(true), + mProceed(false), mEraseMBR(false) { setTitle("File Browser"); @@ -124,9 +129,6 @@ FileBrowserView::~FileBrowserView() { - if (mEditor){ - delete mEditor; - } // if (mSearch !=0) { // delete mSearch; // } @@ -204,6 +206,12 @@ mFileViewMenuActions.mFileRename = mFileViewMenuActions.mFileMenu->addAction("Rename", this, SLOT(fileRename())); mFileViewMenuActions.mFileTouch = mFileViewMenuActions.mFileMenu->addAction("Touch", this, SLOT(fileTouch())); mFileViewMenuActions.mFileProperties = mFileViewMenuActions.mFileMenu->addAction("Properties", this, SLOT(fileProperties())); + + mFileViewMenuActions.mFileChecksumsMenu = mFileViewMenuActions.mFileMenu->addMenu("Checksums"); + mFileViewMenuActions.mFileChecksumsMD5 = mFileViewMenuActions.mFileChecksumsMenu->addAction("MD5", this, SLOT(fileChecksumsMD5())); + mFileViewMenuActions.mFileChecksumsMD2 = mFileViewMenuActions.mFileChecksumsMenu->addAction("MD2", this, SLOT(fileChecksumsMD2())); + mFileViewMenuActions.mFileChecksumsSHA1 = mFileViewMenuActions.mFileChecksumsMenu->addAction("SHA-1", this, SLOT(fileChecksumsSHA1())); + mFileViewMenuActions.mFileSetAttributes = mFileViewMenuActions.mFileMenu->addAction("Set attributes...", this, SLOT(fileSetAttributes())); mFileViewMenuActions.mFileSetAttributes->setVisible(false); } @@ -494,104 +502,70 @@ // --------------------------------------------------------------------------- -void FileBrowserView::fileOpenDialog(const QString& fileName) -{ - Q_UNUSED(fileName); - HbDialog *dialog = new HbDialog(); - dialog->setDismissPolicy(HbPopup::TapOutside); - dialog->setTimeout(HbPopup::NoTimeout); - - // Create a list and some simple content for it - HbListWidget *list = new HbListWidget(); - HbLabel *title = new HbLabel(); - title->setPlainText("Open File"); - dialog->setHeadingWidget(title); - list->addItem("View as text/hex"); - list->addItem("Open w/ AppArc"); - list->addItem("Open w/ DocH. embed"); - - // Connect list item activation signal to close the popup - connect(list, SIGNAL(activated(HbListWidgetItem*)), dialog, SLOT(close())); +void FileBrowserView::fileOpen(HbAction *action) +{ + HbSelectionDialog *dlg = static_cast(sender()); + if(!action && dlg && dlg->selectedModelIndexes().count()){ + int selectionIndex = dlg->selectedModelIndexes().at(0).row(); - HbAction *cancelAction = new HbAction(cancelActionText); - dialog->setPrimaryAction(cancelAction); - - // Set listwidget to be popup's content - dialog->setContentWidget(list); - // Launch popup and handle the user response: - if (dialog->exec() != cancelAction){ - if (list->currentRow() == 0) { - // create and launch editor with selected file item: - if(mEditor != 0){ - delete mEditor; - mEditor = 0; - } - emit aboutToShowEditorView(fileName, true); - } - else if (list->currentRow() == 1) { + if (selectionIndex == 0) { + // open editor view + emit aboutToShowEditorView(mAbsoluteFilePath, true); + } else if (selectionIndex == 1) { // AppArc - mEngineWrapper->openAppArc(fileName); + mEngineWrapper->openAppArc(mAbsoluteFilePath); } else { // DocHandler - mEngineWrapper->openDocHandler(fileName, true); + mEngineWrapper->openDocHandler(mAbsoluteFilePath, true); } } } -// --------------------------------------------------------------------------- - -OverwriteOptions FileBrowserView::fileOverwriteDialog() +/** + Open overwrite dialog + */ +void FileBrowserView::fileOverwriteDialog() { - HbDialog *dialog = new HbDialog(); - dialog->setDismissPolicy(HbPopup::TapOutside); - dialog->setTimeout(HbPopup::NoTimeout); - - // Create a list and some simple content for it - - HbLabel *title = new HbLabel(); - title->setPlainText("Overwrite?"); - dialog->setHeadingWidget(title); - - HbListWidget *list = new HbListWidget(); - list->addItem("Overwrite all"); - list->addItem("Skip all existing"); - list->addItem("Gen. unique filenames"); - list->addItem("Query postfix"); - - // Connect list item activation signal to close the popup - connect(list, SIGNAL(activated(HbListWidgetItem*)), dialog, SLOT(close())); + mOverwriteOptions = OverwriteOptions(); + // open user-dialog to select: view as text/hex, open w/AppArc or open w/DocH. embed + QStringList list; + list << QString("Overwrite all") + << QString("Skip all existing") + << QString("Gen. unique filenames") + << QString("Query postfix"); + openListDialog(list, QString("Overwrite?"), this, SLOT(fileOverwrite(HbAction *))); +} - HbAction *cancelAction = new HbAction(cancelActionText); - dialog->setPrimaryAction(cancelAction); - - // Set listwidget to be popup's content - dialog->setContentWidget(list); - - OverwriteOptions overwriteOptions; - // Launch popup and handle the user response: - if (dialog->exec() != cancelAction) { - overwriteOptions.queryIndex = list->currentRow(); - if (overwriteOptions.queryIndex == EFileActionQueryPostFix) { - HbDialog* dialog = filePathQuery(QString("Postfix"), - QString(), - okActionText, - cancelActionText); - HbAction *action = 0; - action = dialog->exec(); - - HbLineEdit * lineEdit= qobject_cast(dialog->contentWidget()); - if (action && action->text() == "OK" && lineEdit && lineEdit->text() != "") { - overwriteOptions.postFix = lineEdit->text(); - } else { - overwriteOptions.doFileOperations = false; - } - } else if (overwriteOptions.queryIndex == EFileActionSkipAllExisting) { - overwriteOptions.overWriteFlags = 0; +/** + File overwrite + */ +void FileBrowserView::fileOverwrite(HbAction *action) +{ + HbSelectionDialog *dlg = static_cast(sender()); + if(!action && dlg && dlg->selectedModelIndexes().count()) { + mOverwriteOptions.queryIndex = dlg->selectedModelIndexes().at(0).row(); + if (mOverwriteOptions.queryIndex == EFileActionQueryPostFix) { + QString heading = QString("Postfix"); + HbInputDialog::getText(heading, this, SLOT(fileOverwritePostfix(HbAction *)), QString(), scene()); + } else if (mOverwriteOptions.queryIndex == EFileActionSkipAllExisting) { + mOverwriteOptions.overWriteFlags = 0; } } else { - overwriteOptions.doFileOperations = false; + mOverwriteOptions.doFileOperations = false; } - return overwriteOptions; +} + +/** + File overwrite postfix query dialog + */ +void FileBrowserView::fileOverwritePostfix(HbAction *action) +{ + HbInputDialog *dlg = static_cast(sender()); + if (action == dlg->primaryAction()) { + mOverwriteOptions.postFix = dlg->value().toString(); + } else { + mOverwriteOptions.doFileOperations = false; + } } // --------------------------------------------------------------------------- @@ -646,28 +620,28 @@ // --------------------------------------------------------------------------- -HbDialog *FileBrowserView::openTextQuery(const QString &headingText, - const QString &text, - const QString &primaryActionText, - const QString &secondaryActionText) -{ - HbDialog *dialog = new HbDialog(); - dialog->setDismissPolicy(HbPopup::TapOutside); - dialog->setTimeout(HbPopup::NoTimeout); - HbLineEdit *edit = new HbLineEdit(); - HbAction *primaryAction = new HbAction(primaryActionText); - HbAction *secondaryAction = new HbAction(secondaryActionText); - // connect signal to close pop-up if cancel selected: - connect(secondaryAction, SIGNAL(triggered()), dialog, SLOT(close())); - edit->setText(text); - dialog->setHeadingWidget(new HbLabel(headingText)); - //popup->setHeadingWidget(dlgTitle); - dialog->setContentWidget(edit); - dialog->setPrimaryAction(primaryAction); - dialog->setSecondaryAction(secondaryAction); - - return dialog; -} +//HbDialog *FileBrowserView::openTextQuery(const QString &headingText, +// const QString &text, +// const QString &primaryActionText, +// const QString &secondaryActionText) +//{ +// HbDialog *dialog = new HbDialog(); +// dialog->setDismissPolicy(HbPopup::TapOutside); +// dialog->setTimeout(HbPopup::NoTimeout); +// HbLineEdit *edit = new HbLineEdit(); +// HbAction *primaryAction = new HbAction(primaryActionText); +// HbAction *secondaryAction = new HbAction(secondaryActionText); +// // connect signal to close pop-up if cancel selected: +// connect(secondaryAction, SIGNAL(triggered()), dialog, SLOT(close())); +// edit->setText(text); +// dialog->setHeadingWidget(new HbLabel(headingText)); +// //popup->setHeadingWidget(dlgTitle); +// dialog->setContentWidget(edit); +// dialog->setPrimaryAction(primaryAction); +// dialog->setSecondaryAction(secondaryAction); +// +// return dialog; +//} // --------------------------------------------------------------------------- @@ -912,48 +886,59 @@ } /** - Rename actually selected files + Open rename dialog for actually selected files */ void FileBrowserView::fileRename() { - QModelIndex index; QModelIndexList currentSelection = getSelectedItemsOrCurrentItem(); mEngineWrapper->setCurrentSelection(currentSelection); - for (int i(0), ie(currentSelection.count()); igetFileEntry(index); - HbDialog* dialog = filePathQuery(QString("Enter new name"), - entry.name(), - okActionText, - cancelActionText); - HbAction *action = 0; - action = dialog->exec(); + for (int i(0), ie(currentSelection.count()); i < ie; ++i ) { + mModelIndex = currentSelection.at(i); + FileEntry entry = mEngineWrapper->getFileEntry(mModelIndex); - bool doRenameOperation(true); - HbLineEdit * lineEdit= qobject_cast(dialog->contentWidget()); - if (action && action->text() == okActionText && lineEdit && lineEdit->text() != "") { - newName = lineEdit->text(); + QString heading = QString("Enter new name"); + HbInputDialog::getText(heading, this, SLOT(doFileRename(HbAction*)), entry.name(), scene()); - if (mEngineWrapper->targetExists(index, newName)) { - const QString messageTemplate = QString("%1 already exists, overwrite?"); - QString message = messageTemplate.arg(newName); -// TODO: deprecated - if (HbMessageBox::question(message)) { - doRenameOperation = false; - } - } - if (doRenameOperation) { - mEngineWrapper->rename(index, newName); - } - } } mEngineWrapper->startExecutingCommands(QString("Renaming")); refreshList(); } /** + Rename actually selected files + */ +void FileBrowserView::doFileRename(HbAction *action) +{ + HbInputDialog *dlg = static_cast(sender()); + if (action == dlg->primaryAction()) + { + QString newName = dlg->value().toString(); + + if (mEngineWrapper->targetExists(mModelIndex, newName)) { + + const QString messageTemplate = QString("%1 already exists, overwrite?"); + QString message = messageTemplate.arg(newName); + HbMessageBox::question(message, this, SLOT(doFileRenameFileExist(HbAction *))); + } + if (mIsRenameAllowed) { + mEngineWrapper->rename(mModelIndex, newName); + } + } +} + +/** + Rename actually selected files + */ +void FileBrowserView::doFileRenameFileExist(HbAction *action) +{ + HbMessageBox *dlg = qobject_cast(sender()); + if (action == dlg->secondaryAction()) { + mIsRenameAllowed = false; + } +} + +/** Touch actually selected files */ void FileBrowserView::fileTouch() @@ -985,6 +970,27 @@ refreshList(); } +void FileBrowserView::fileChecksumsMD5() +{ + fileChecksums(EFileChecksumsMD5); +} + +void FileBrowserView::fileChecksumsMD2() +{ + fileChecksums(EFileChecksumsMD2); +} + +void FileBrowserView::fileChecksumsSHA1() +{ + fileChecksums(EFileChecksumsSHA1); +} + +void FileBrowserView::fileChecksums(TFileBrowserCmdFileChecksums checksumType) +{ + QModelIndex currentIndex = currentItemIndex(); + mEngineWrapper->showFileCheckSums(currentIndex, checksumType); +} + /** Show file properties */ @@ -1050,15 +1056,14 @@ void FileBrowserView::editPaste() { bool someEntryExists(false); - OverwriteOptions overwriteOptions; // TODO Set entry items here someEntryExists = mEngineWrapper->isDestinationEntriesExists(mClipboardIndices, mEngineWrapper->currentPath()); if (someEntryExists) { - overwriteOptions = fileOverwriteDialog(); + fileOverwriteDialog(); } - mEngineWrapper->clipboardPaste(overwriteOptions); + mEngineWrapper->clipboardPaste(mOverwriteOptions); } /** @@ -1080,7 +1085,6 @@ { QString targetDir = dlg->value().toString(); bool someEntryExists(false); - OverwriteOptions overwriteOptions; // TODO Set entry items here QModelIndexList currentSelection = getSelectedItemsOrCurrentItem(); @@ -1088,9 +1092,9 @@ someEntryExists = mEngineWrapper->isDestinationEntriesExists(currentSelection, targetDir); if (someEntryExists) { - overwriteOptions = fileOverwriteDialog(); + fileOverwriteDialog(); } - mEngineWrapper->copyToFolder(targetDir, overwriteOptions, false); + mEngineWrapper->copyToFolder(targetDir, mOverwriteOptions, false); refreshList(); } } @@ -1114,7 +1118,6 @@ { QString targetDir = dlg->value().toString(); bool someEntryExists(false); - OverwriteOptions overwriteOptions; // TODO Set entry items here QModelIndexList currentSelection = getSelectedItemsOrCurrentItem(); @@ -1122,9 +1125,9 @@ someEntryExists = mEngineWrapper->isDestinationEntriesExists(currentSelection, targetDir); if (someEntryExists) { - overwriteOptions = fileOverwriteDialog(); + fileOverwriteDialog(); } - mEngineWrapper->copyToFolder(targetDir, overwriteOptions, true); + mEngineWrapper->copyToFolder(targetDir, mOverwriteOptions, true); refreshList(); } } @@ -1537,46 +1540,94 @@ /** Partition the selected drive */ +void FileBrowserView::diskAdminPartitionDrive() +{ + const QString message("Are you sure? Your media driver must support this!"); + HbMessageBox::question(message, this, SLOT(diskAdminPartitionDriveProceed(HbAction *))); +} + +/** + Partition the selected drive if user is sure + */ +void FileBrowserView::diskAdminPartitionDriveProceed(HbAction *action) +{ + HbMessageBox *dlg = qobject_cast(sender()); + if (action == dlg->primaryAction()) { + const QString message("Are you really sure you know what are you doing ?!?"); + HbMessageBox::question(message, this, SLOT(diskAdminPartitionDriveReallyProceed(HbAction *))); + } +} + +/** + Partition the selected drive if user is really sure + */ +void FileBrowserView::diskAdminPartitionDriveReallyProceed(HbAction *action) +{ + HbMessageBox *dlg = qobject_cast(sender()); + if (action == dlg->primaryAction()) { + QModelIndex currentIndex = currentItemIndex(); + mEraseMBR = false; + // warn if the selected drive is not detected as removable + if (mEngineWrapper->isDriveRemovable(currentIndex)) { + mProceed = true; + } else { + const QString message("Selected drive is not removable, really continue?"); + HbMessageBox::question(message, this, SLOT(diskAdminPartitionDriveIsNotRemovable(HbAction *))); + } + + if (mProceed) { + // query if erase mbr + mEraseMBR = false; + + QString message("Erase MBR first (normally needed)?"); + HbMessageBox::question(message, this, SLOT(diskAdminPartitionDriveEraseMbr(HbAction *))); + + // TODO use HbListDialog + QStringList list; + list << "1" << "2" << "3" << "4"; + openListDialog(list, QString("Partitions?"), this, SLOT(diskAdminPartitionDriveGetCount(HbAction*))); + } + } +} + +/** + Store result of user query about proceeding when drive is not removable. + */ +void FileBrowserView::diskAdminPartitionDriveIsNotRemovable(HbAction *action) +{ + HbMessageBox *dlg = qobject_cast(sender()); + if (action == dlg->primaryAction()) { + mProceed = true; + } else { + mProceed = false; + } +} + +/** + Store result of user query about erase MBR + */ +void FileBrowserView::diskAdminPartitionDriveEraseMbr(HbAction *action) +{ + HbMessageBox *dlg = qobject_cast(sender()); + if (action == dlg->primaryAction()) { + mEraseMBR = true; + } +} + +/** + Partition the selected drive + */ void FileBrowserView::diskAdminPartitionDriveGetCount(HbAction* action) { HbSelectionDialog *dlg = static_cast(sender()); - if(!action && dlg->selectedItems().count()){ - int selectionIndex = dlg->selectedItems().at(0).toInt(); + if(!action && dlg && dlg->selectedItems().count()){ + int selectionIndex = dlg->selectedItems().at(0).toInt(); QModelIndex currentIndex = currentItemIndex(); int amountOfPartitions = selectionIndex + 1; mEngineWrapper->DiskAdminPartitionDrive(currentIndex, mEraseMBR, amountOfPartitions); refreshList(); } } -void FileBrowserView::diskAdminPartitionDrive() -{ - if (HbMessageBox::question(QString("Are you sure? Your media driver must support this!"))) { - if (HbMessageBox::question(QString("Are you really sure you know what are you doing ?!?"))) { - QModelIndex currentIndex = currentItemIndex(); - // warn if the selected drive is not detected as removable - bool proceed(false); - if (mEngineWrapper->isDriveRemovable(currentIndex)) { - proceed = true; - } else { - proceed = HbMessageBox::question(QString("Selected drive is not removable, really continue?")); - } - - if (proceed) { - // query if erase mbr - mEraseMBR = false; - - if (HbMessageBox::question(QString("Erase MBR first (normally needed)?"))) { - mEraseMBR = true; - } - - // TODO use HbListDialog - QStringList list; - list << "1" << "2" << "3" << "4"; - openListDialog(list, QString("Partitions?"), this, SLOT(diskAdminPartitionDriveGetCount(HbAction*))); - } - } - } -} // --------------------------------------------------------------------------- // tools menu @@ -1816,7 +1867,7 @@ */ void FileBrowserView::about() { - Notifications::about(); + Notifications::showAboutNote(); } // --------------------------------------------------------------------------- @@ -1864,9 +1915,12 @@ } else { // file item // mSelectedFilePath = filePath; FileEntry fileEntry = mEngineWrapper->getFileEntry(index); - QString absolutePath = fileEntry.path() + fileEntry.name(); + mAbsoluteFilePath = fileEntry.path() + fileEntry.name(); + // open user-dialog to select: view as text/hex, open w/AppArc or open w/DocH. embed - fileOpenDialog(absolutePath); + QStringList list; + list << QString("View as text/hex") << QString("Open w/ AppArc") << QString("Open w/ DocH. embed"); + openListDialog(list, QString("Open file"), this, SLOT(fileOpen(HbAction *))); } } } diff -r 6053b7ae82ab -r 31fc1277642e filebrowser/ui/src/notifications.cpp --- a/filebrowser/ui/src/notifications.cpp Thu May 13 20:59:38 2010 +0300 +++ b/filebrowser/ui/src/notifications.cpp Thu May 13 21:10:48 2010 +0300 @@ -29,24 +29,22 @@ { HbMessageBox *messageBox = new HbMessageBox(type); messageBox->setText(text); - if(label.length()) - { + if (label.length()) { HbLabel *header = new HbLabel(label, messageBox); messageBox->setHeadingWidget(header); - } + } messageBox->setAttribute(Qt::WA_DeleteOnClose); messageBox->setTimeout(timeout); messageBox->open(); } -void Notifications::about() +void Notifications::showAboutNote() { - showMessageBox( - HbMessageBox::MessageTypeInformation, - "Version 5.0.0 - 23h April 2010. Copyright © 2010 Nokia Corporation" - "and/or its subsidiary(-ies). All rights reserved." - "Licensed under Eclipse Public License v1.0.", - "About File Browser" + showMessageBox(HbMessageBox::MessageTypeInformation, + "Version 5.0.0 - 23h April 2010. Copyright © 2010 Nokia Corporation" + "and/or its subsidiary(-ies). All rights reserved." + "Licensed under Eclipse Public License v1.0.", + "About File Browser" ); } @@ -62,16 +60,16 @@ // --------------------------------------------------------------------------- -void Notifications::showInformationNote(const QString &text) +void Notifications::showInformationNote(const QString &text, const QString &title) { - showMessageBox(HbMessageBox::MessageTypeInformation, text, "", false); + showMessageBox(HbMessageBox::MessageTypeInformation, text, title, false); } // --------------------------------------------------------------------------- void Notifications::showErrorNote(const QString &text, bool noTimeout) { - showMessageBox(HbMessageBox::MessageTypeWarning, text, "", noTimeout ? HbPopup::NoTimeout : 3000); + showMessageBox(HbMessageBox::MessageTypeWarning, text, "", noTimeout ? HbPopup::NoTimeout : HbPopup::StandardTimeout); } // --------------------------------------------------------------------------- @@ -85,7 +83,7 @@ bool Notifications::showConfirmationQuery(const QString &aText) { - return HbMessageBox::question(aText); + return false; //HbMessageBox::question(aText); } // ---------------------------------------------------------------------------