--- a/filemanager/src/fmfiledialog/src/fmfiledialog.cpp Tue Aug 24 10:24:14 2010 +0800
+++ b/filemanager/src/fmfiledialog/src/fmfiledialog.cpp Wed Sep 29 10:37:03 2010 +0800
@@ -25,13 +25,15 @@
#include "fmdrivemodel.h"
#include "fmcommon.h"
-#include "hbwidget.h"
-#include "hblabel.h"
-#include "hbaction.h"
-#include "hbpushbutton.h"
-#include "hblineedit.h"
-
+#include <hbwidget.h>
+#include <hblabel.h>
+#include <hbaction.h>
+#include <hbpushbutton.h>
+#include <hblineedit.h>
+#include <hbtranslator.h>
+
#include <QGraphicsLinearLayout>
+#include <QEventLoop>
FmFileDialog::FmFileDialog( QGraphicsItem *parent ) :
HbDialog( parent ), d_ptr( new FmFileDialogPrivate( this ) )
@@ -49,7 +51,9 @@
const QStringList &nameFilters,
Options options )
{
-
+ HbTranslator translator("filemanager");
+ translator.loadCommon();
+
QString ret;
FmFileDialogPrivate::FmFileDialogArgs args;
@@ -78,7 +82,9 @@
const QStringList &nameFilters,
Options options )
{
-
+ HbTranslator translator("filemanager");
+ translator.loadCommon();
+
QString ret;
FmFileDialogPrivate::FmFileDialogArgs args;
@@ -109,6 +115,9 @@
const QStringList &nameFilters,
Options options )
{
+ HbTranslator translator("filemanager");
+ translator.loadCommon();
+
QString ret;
FmFileDialogPrivate::FmFileDialogArgs args;
@@ -136,13 +145,70 @@
bool FmFileDialog::exec()
{
- if ( d_ptr->isOkAction( HbDialog::exec() ) ) {
+ HbDialog::open( this, SLOT(dialogClosed(HbAction*)) );
+ d_ptr->eventLoop().exec();
+
+ if ( d_ptr->isOkAction( d_ptr->retAction() ) ) {
return true;
} else {
return false ;
}
}
+void FmFileDialog::dialogClosed(HbAction *action)
+{
+ d_ptr->setRetAction( action );
+ d_ptr->eventLoop().exit();
+}
+HbAction *FmFileDialog::primaryAction() const
+{
+ QList<QAction *> actionList = QGraphicsWidget::actions();
+ if (actionList.size() > 0) {
+ return (HbAction *)(actionList.at(0));
+ } else {
+ return 0;
+ }
+
+}
+void FmFileDialog::setPrimaryAction( HbAction *action )
+{
+ QList<QAction *> actionList = QGraphicsWidget::actions();
+ if (actionList.size() == 0) {
+ QGraphicsWidget::addAction(action);
+ } else if (actionList.size() == 1) {
+ actionList.clear();
+ QGraphicsWidget::addAction(action);
+ } else if (actionList.size() == 2) {
+ actionList.removeAt(0);
+ actionList.insert(0, action);
+ }
+}
+
+HbAction *FmFileDialog::secondaryAction() const
+{
+ QList<QAction *> actionList = QGraphicsWidget::actions();
+ if (actionList.size() > 1) {
+ return (HbAction *)(actionList.at(1));
+ } else {
+ return 0;
+ }
+}
+
+void FmFileDialog::setSecondaryAction( HbAction *action )
+{
+ QList<QAction *> actionList = QGraphicsWidget::actions();
+ if (actionList.size() == 0) {
+ QGraphicsWidget::addAction(new HbAction(hbTrId("Ok")));
+ QGraphicsWidget::addAction(action);
+ } else if (actionList.size() == 1) {
+ QGraphicsWidget::addAction(action);
+ } else if (actionList.size() == 2) {
+ actionList.removeAt(1);
+ actionList.insert(1, action);
+ }
+
+}
+