--- a/creator/inc/notifications.h Fri May 14 15:53:02 2010 +0300
+++ b/creator/inc/notifications.h Thu May 13 20:59:38 2010 +0300
@@ -31,11 +31,7 @@
Q_OBJECT
public:
- /**
- * shows massage box
- */
- static void showMessageBox(HbMessageBox::MessageBoxType type, const QString &text, const QString &label, int timeout );
-
+
/**
* shows about box
*/
--- a/creator/src/notifications.cpp Fri May 14 15:53:02 2010 +0300
+++ b/creator/src/notifications.cpp Thu May 13 20:59:38 2010 +0300
@@ -31,48 +31,38 @@
#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()
{
- 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
- );
+ 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();
}
// ---------------------------------------------------------------------------
void Notifications::error(const QString& errorMessage)
{
- showMessageBox(HbMessageBox::MessageTypeWarning, errorMessage, QString("Error"), 3000);
+ HbMessageBox::warning(errorMessage, new HbLabel("Error"));
}
// ---------------------------------------------------------------------------
+
HbProgressDialog* Notifications::showProgressBar(const QString& text, int max)
{
HbProgressDialog *note = new HbProgressDialog(HbProgressDialog::ProgressDialog);
note->setText(text);
note->setMaximum(max);
+
note->show();
return note;
@@ -80,9 +70,12 @@
// ---------------------------------------------------------------------------
-void Notifications::showGlobalNote(const QString& text, HbMessageBox::MessageBoxType type, HbPopup::DefaultTimeout timeout)
+void Notifications::showGlobalNote(const QString& text, HbMessageBox::MessageBoxType type, HbPopup::DefaultTimeout /*timeout*/)
{
- showMessageBox(type, text, QString("Creator"), timeout);
+ if (type == HbMessageBox::HbMessageBox::MessageTypeInformation)
+ HbMessageBox::information(text, new HbLabel("Information"));
+ else
+ HbMessageBox::information(text, new HbLabel("Information"));
}
// ---------------------------------------------------------------------------
@@ -122,14 +115,13 @@
popup->setSecondaryAction(actionCancel);
// Launch popup syncronously
- popup->setAttribute(Qt::WA_DeleteOnClose);
- // TODO: handle dialog close & user input
- popup->open();
+ HbAction *action = 0;
+ action = popup->exec();
// 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;
}
@@ -163,15 +155,14 @@
popup->setSecondaryAction(actionCancel);
// Launch popup syncronously
- popup->setAttribute(Qt::WA_DeleteOnClose);
- // TODO: handle dialog close & user input
- popup->open();
+ HbAction *action = 0;
+ action = popup->exec();
// 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;
}
@@ -179,8 +170,7 @@
bool Notifications::yesNoQueryDialog(const QString& text)
{
- HbMessageBox::question(text, 0, 0);
- return false;
+ return HbMessageBox::question(text);
}
// ---------------------------------------------------------------------------
@@ -220,15 +210,14 @@
popup->setSecondaryAction(actionCancel);
// Launch popup syncronously
- popup->setAttribute(Qt::WA_DeleteOnClose);
- // TODO: handle dialog close & user input
- popup->open();
+ HbAction *action = 0;
+ action = popup->exec();
// 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;
}
--- a/filebrowser/ui/inc/enginewrapper.h Fri May 14 15:53:02 2010 +0300
+++ b/filebrowser/ui/inc/enginewrapper.h Thu May 13 20:59:38 2010 +0300
@@ -18,17 +18,16 @@
#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 <QString>
#include <QStringList>
#include <QModelIndexList>
+#include <driveentry.h>
+#include <fileentry.h>
+#include <engine.h>
+
+#include "filebrowsersettings.h"
+
+#include <FBFileUtils.h>
class CEngine;
class SearchAttributes;
@@ -76,7 +75,9 @@
public: // from MFileBrowserUI
/* Functions that are called from engine: */
- void ShowInformationNote(const TDesC &aDescText, const TDesC &aDescTitle);
+// TInt QueryCurrentItemIndex();
+
+ void ShowInformationNote(const TDesC& aDescText);
void ShowErrorNote(const TDesC& aDescText, TBool aNoTimeout = EFalse);
void ShowConfirmationNote(const TDesC& aDescText, TBool aNoTimeout = EFalse);
TBool ShowConfirmationQuery(const TDesC& aDescText);
@@ -158,8 +159,6 @@
quint32 getDebugMask();
void toolsSetDebugMask(quint32 aDbgMask);
- void showFileCheckSums(const QModelIndex &aIndex, TFileBrowserCmdFileChecksums checksumType);
-
private:
// FB engine
CEngine *mEngine;
--- a/filebrowser/ui/inc/filebrowserview.h Fri May 14 15:53:02 2010 +0300
+++ b/filebrowser/ui/inc/filebrowserview.h Thu May 13 20:59:38 2010 +0300
@@ -18,13 +18,12 @@
#ifndef FILEBROWSERVIEWH_H_
#define FILEBROWSERVIEWH_H_
+#include <hbview.h>
+#include <hbmainwindow.h>
+#include <hbapplication.h>
#include "menuaction.h"
#include "enginewrapper.h"
-#include <HbView>
-#include <HbMainWindow>
-#include <HbApplication>
-
#include <QDir>
// Forward declarations
@@ -67,7 +66,8 @@
public slots:
private:
- void fileOverwriteDialog();
+ void fileOpenDialog(const QString &fileName);
+ OverwriteOptions 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,36 +109,23 @@
void refreshList();
void populateFolderContent();
-private slots:
+private slots: // option menu 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
@@ -146,13 +133,10 @@
void editCut();
void editCopy();
void editPaste();
-
void editCopyToFolder();
void doEditCopyToFolder(HbAction *);
-
void editMoveToFolder();
void doEditMoveToFolder(HbAction *);
-
void editSelect();
void editUnselect();
void editSelectAll();
@@ -196,18 +180,13 @@
void diskAdminEjectDrive();
void diskAdminDismountDrive();
void doDiskAdminDismountDrive(HbAction *);
-
void diskAdminEraseMBR();
void doDiskAdminEraseMBR(HbAction *);
void doDiskAdminReallyEraseMBR(HbAction *);
void doDiskAdminNotRemovableReallyEraseMBR(HbAction *);
+ void diskAdminPartitionDriveGetCount(HbAction*);
void diskAdminPartitionDrive();
- void diskAdminPartitionDriveProceed(HbAction *);
- void diskAdminPartitionDriveReallyProceed(HbAction *);
- void diskAdminPartitionDriveIsNotRemovable(HbAction *);
- void diskAdminPartitionDriveEraseMbr(HbAction *);
- void diskAdminPartitionDriveGetCount(HbAction*);
// tools menu
void toolsAllAppsToTextFile();
@@ -263,10 +242,6 @@
void activateSelectionMode();
void deActivateSelectionMode();
- void fileOpen(HbAction *);
- void fileOverwrite(HbAction *);
- void fileOverwritePostfix(HbAction *);
-
private:
FileBrowserMainWindow &mMainWindow;
EngineWrapper *mEngineWrapper;
@@ -287,6 +262,8 @@
MenuAction mFileViewMenuActions;
HbAction *mToolbarBackAction;
+ // editor
+ EditorView *mEditor;
// search
SearchView *mSearch;
// settings
@@ -298,16 +275,10 @@
bool mRemoveFileAfterCopied;
bool mClipBoardInUse;
bool mFolderContentChanged;
-
- // temporarily storage
+ bool mEraseMBR;
+ // temporarily stored old passwird
QString mOldPassword;
QString mPanicCategory;
- QString mAbsoluteFilePath;
- OverwriteOptions mOverwriteOptions;
- QModelIndex mModelIndex;
- bool mIsRenameAllowed;
- bool mProceed;
- bool mEraseMBR;
};
--- a/filebrowser/ui/inc/notifications.h Fri May 14 15:53:02 2010 +0300
+++ b/filebrowser/ui/inc/notifications.h Thu May 13 20:59:38 2010 +0300
@@ -22,20 +22,33 @@
#include <hbmessagebox.h>
class Notifications
-{
+ {
public:
- static void showAboutNote();
+ /**
+ * shows about box
+ */
+ static void about();
static void showMessageBox(HbMessageBox::MessageBoxType type, const QString &text, const QString &label, int timeout = HbPopup::NoTimeout);
- static void showInformationNote(const QString &text, const QString &title = QString());
+ static void showInformationNote(const QString &text);
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_
--- a/filebrowser/ui/src/enginewrapper.cpp Fri May 14 15:53:02 2010 +0300
+++ b/filebrowser/ui/src/enginewrapper.cpp Thu May 13 20:59:38 2010 +0300
@@ -686,11 +686,6 @@
mEngine->FileUtils()->SetDebugMaskL(aDbgMask);
}
-void EngineWrapper::showFileCheckSums(const QModelIndex &aIndex, TFileBrowserCmdFileChecksums checksumType)
-{
- mEngine->FileUtils()->ShowFileCheckSumsL(aIndex.row(), checksumType);
-}
-
// ---------------------------------------------------------------------------
// Functions that are called from engine
// ---------------------------------------------------------------------------
@@ -705,11 +700,10 @@
// ---------------------------------------------------------------------------
-void EngineWrapper::ShowInformationNote(const TDesC &aDescText, const TDesC &aDescTitle)
+void EngineWrapper::ShowInformationNote(const TDesC& aDescText)
{
- QString qText = QString::fromUtf16(aDescText.Ptr(), aDescText.Length());
- QString qTitle = QString::fromUtf16(aDescTitle.Ptr(), aDescTitle.Length());
- Notifications::showInformationNote(qText, qTitle);
+ QString qStringText = QString::fromUtf16(aDescText.Ptr(), aDescText.Length());
+ Notifications::showInformationNote(qStringText);
}
// ---------------------------------------------------------------------------
--- a/filebrowser/ui/src/filebrowserview.cpp Fri May 14 15:53:02 2010 +0300
+++ b/filebrowser/ui/src/filebrowserview.cpp Thu May 13 20:59:38 2010 +0300
@@ -67,6 +67,7 @@
mFileBrowserModel(0),
mFileViewMenuActions(),
mToolbarBackAction(0),
+ mEditor(0),
mSearch(0),
mSettingsView(0),
mItemHighlighted(false),
@@ -74,12 +75,6 @@
mRemoveFileAfterCopied(false),
mClipBoardInUse(false),
mFolderContentChanged(false),
- mOldPassword(),
- mPanicCategory(),
- mAbsoluteFilePath(),
- mOverwriteOptions(),
- mIsRenameAllowed(true),
- mProceed(false),
mEraseMBR(false)
{
setTitle("File Browser");
@@ -129,6 +124,9 @@
FileBrowserView::~FileBrowserView()
{
+ if (mEditor){
+ delete mEditor;
+ }
// if (mSearch !=0) {
// delete mSearch;
// }
@@ -206,12 +204,6 @@
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);
}
@@ -502,70 +494,104 @@
// ---------------------------------------------------------------------------
-void FileBrowserView::fileOpen(HbAction *action)
-{
- HbSelectionDialog *dlg = static_cast<HbSelectionDialog*>(sender());
- if(!action && dlg && dlg->selectedModelIndexes().count()){
- int selectionIndex = dlg->selectedModelIndexes().at(0).row();
+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()));
- if (selectionIndex == 0) {
- // open editor view
- emit aboutToShowEditorView(mAbsoluteFilePath, true);
- } else if (selectionIndex == 1) {
+ 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) {
// AppArc
- mEngineWrapper->openAppArc(mAbsoluteFilePath);
+ mEngineWrapper->openAppArc(fileName);
} else {
// DocHandler
- mEngineWrapper->openDocHandler(mAbsoluteFilePath, true);
+ mEngineWrapper->openDocHandler(fileName, true);
}
}
}
-/**
- Open overwrite dialog
- */
-void FileBrowserView::fileOverwriteDialog()
+// ---------------------------------------------------------------------------
+
+OverwriteOptions FileBrowserView::fileOverwriteDialog()
{
- 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 *)));
-}
+ 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()));
+
+ HbAction *cancelAction = new HbAction(cancelActionText);
+ dialog->setPrimaryAction(cancelAction);
-/**
- File overwrite
- */
-void FileBrowserView::fileOverwrite(HbAction *action)
-{
- HbSelectionDialog *dlg = static_cast<HbSelectionDialog*>(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;
+ // 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<HbLineEdit *>(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;
}
} else {
- mOverwriteOptions.doFileOperations = false;
+ overwriteOptions.doFileOperations = false;
}
-}
-
-/**
- File overwrite postfix query dialog
- */
-void FileBrowserView::fileOverwritePostfix(HbAction *action)
-{
- HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
- if (action == dlg->primaryAction()) {
- mOverwriteOptions.postFix = dlg->value().toString();
- } else {
- mOverwriteOptions.doFileOperations = false;
- }
+ return overwriteOptions;
}
// ---------------------------------------------------------------------------
@@ -620,28 +646,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;
+}
// ---------------------------------------------------------------------------
@@ -886,59 +912,48 @@
}
/**
- Open rename dialog for actually selected files
+ Rename actually selected files
*/
void FileBrowserView::fileRename()
{
+ QModelIndex index;
QModelIndexList currentSelection = getSelectedItemsOrCurrentItem();
mEngineWrapper->setCurrentSelection(currentSelection);
- for (int i(0), ie(currentSelection.count()); i < ie; ++i ) {
- mModelIndex = currentSelection.at(i);
- FileEntry entry = mEngineWrapper->getFileEntry(mModelIndex);
+ for (int i(0), ie(currentSelection.count()); i<ie; ++i ) {
+ index = currentSelection.at(i);
+ QString newName;
+ FileEntry entry = mEngineWrapper->getFileEntry(index);
+ HbDialog* dialog = filePathQuery(QString("Enter new name"),
+ entry.name(),
+ okActionText,
+ cancelActionText);
+ HbAction *action = 0;
+ action = dialog->exec();
- QString heading = QString("Enter new name");
- HbInputDialog::getText(heading, this, SLOT(doFileRename(HbAction*)), entry.name(), scene());
+ bool doRenameOperation(true);
+ HbLineEdit * lineEdit= qobject_cast<HbLineEdit *>(dialog->contentWidget());
+ if (action && action->text() == okActionText && lineEdit && lineEdit->text() != "") {
+ newName = lineEdit->text();
+ 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<HbInputDialog*>(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<HbMessageBox*>(sender());
- if (action == dlg->secondaryAction()) {
- mIsRenameAllowed = false;
- }
-}
-
-/**
Touch actually selected files
*/
void FileBrowserView::fileTouch()
@@ -970,27 +985,6 @@
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
*/
@@ -1056,14 +1050,15 @@
void FileBrowserView::editPaste()
{
bool someEntryExists(false);
+ OverwriteOptions overwriteOptions;
// TODO Set entry items here
someEntryExists = mEngineWrapper->isDestinationEntriesExists(mClipboardIndices, mEngineWrapper->currentPath());
if (someEntryExists) {
- fileOverwriteDialog();
+ overwriteOptions = fileOverwriteDialog();
}
- mEngineWrapper->clipboardPaste(mOverwriteOptions);
+ mEngineWrapper->clipboardPaste(overwriteOptions);
}
/**
@@ -1085,6 +1080,7 @@
{
QString targetDir = dlg->value().toString();
bool someEntryExists(false);
+ OverwriteOptions overwriteOptions;
// TODO Set entry items here
QModelIndexList currentSelection = getSelectedItemsOrCurrentItem();
@@ -1092,9 +1088,9 @@
someEntryExists = mEngineWrapper->isDestinationEntriesExists(currentSelection, targetDir);
if (someEntryExists) {
- fileOverwriteDialog();
+ overwriteOptions = fileOverwriteDialog();
}
- mEngineWrapper->copyToFolder(targetDir, mOverwriteOptions, false);
+ mEngineWrapper->copyToFolder(targetDir, overwriteOptions, false);
refreshList();
}
}
@@ -1118,6 +1114,7 @@
{
QString targetDir = dlg->value().toString();
bool someEntryExists(false);
+ OverwriteOptions overwriteOptions;
// TODO Set entry items here
QModelIndexList currentSelection = getSelectedItemsOrCurrentItem();
@@ -1125,9 +1122,9 @@
someEntryExists = mEngineWrapper->isDestinationEntriesExists(currentSelection, targetDir);
if (someEntryExists) {
- fileOverwriteDialog();
+ overwriteOptions = fileOverwriteDialog();
}
- mEngineWrapper->copyToFolder(targetDir, mOverwriteOptions, true);
+ mEngineWrapper->copyToFolder(targetDir, overwriteOptions, true);
refreshList();
}
}
@@ -1540,94 +1537,46 @@
/**
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<HbMessageBox*>(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<HbMessageBox*>(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<HbMessageBox*>(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<HbMessageBox*>(sender());
- if (action == dlg->primaryAction()) {
- mEraseMBR = true;
- }
-}
-
-/**
- Partition the selected drive
- */
void FileBrowserView::diskAdminPartitionDriveGetCount(HbAction* action)
{
HbSelectionDialog *dlg = static_cast<HbSelectionDialog*>(sender());
- if(!action && dlg && dlg->selectedItems().count()){
- int selectionIndex = dlg->selectedItems().at(0).toInt();
+ if(!action && 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
@@ -1867,7 +1816,7 @@
*/
void FileBrowserView::about()
{
- Notifications::showAboutNote();
+ Notifications::about();
}
// ---------------------------------------------------------------------------
@@ -1915,12 +1864,9 @@
} else { // file item
// mSelectedFilePath = filePath;
FileEntry fileEntry = mEngineWrapper->getFileEntry(index);
- mAbsoluteFilePath = fileEntry.path() + fileEntry.name();
-
+ QString absolutePath = fileEntry.path() + fileEntry.name();
// open user-dialog to select: view as text/hex, open w/AppArc or open w/DocH. embed
- 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 *)));
+ fileOpenDialog(absolutePath);
}
}
}
--- a/filebrowser/ui/src/notifications.cpp Fri May 14 15:53:02 2010 +0300
+++ b/filebrowser/ui/src/notifications.cpp Thu May 13 20:59:38 2010 +0300
@@ -29,22 +29,24 @@
{
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::showAboutNote()
+void Notifications::about()
{
- 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"
);
}
@@ -60,16 +62,16 @@
// ---------------------------------------------------------------------------
-void Notifications::showInformationNote(const QString &text, const QString &title)
+void Notifications::showInformationNote(const QString &text)
{
- showMessageBox(HbMessageBox::MessageTypeInformation, text, title, false);
+ showMessageBox(HbMessageBox::MessageTypeInformation, text, "", false);
}
// ---------------------------------------------------------------------------
void Notifications::showErrorNote(const QString &text, bool noTimeout)
{
- showMessageBox(HbMessageBox::MessageTypeWarning, text, "", noTimeout ? HbPopup::NoTimeout : HbPopup::StandardTimeout);
+ showMessageBox(HbMessageBox::MessageTypeWarning, text, "", noTimeout ? HbPopup::NoTimeout : 3000);
}
// ---------------------------------------------------------------------------
@@ -83,7 +85,7 @@
bool Notifications::showConfirmationQuery(const QString &aText)
{
- return false; //HbMessageBox::question(aText);
+ return HbMessageBox::question(aText);
}
// ---------------------------------------------------------------------------