--- a/filemanager/src/filemanager/src/components/fmdlgutils.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/components/fmdlgutils.cpp Fri Jun 25 17:08:34 2010 +0800
@@ -23,6 +23,8 @@
#include "fmmultitextquery.h"
#include "fmutils.h"
#include "fmviewmanager.h"
+#include "fmmessagebox.h"
+#include "fmdrivequery.h"
#include <QString>
#include <QStringList>
@@ -30,8 +32,7 @@
#include <hblabel.h>
#include <hbaction.h>
-#include <hbmessagebox.h>
-
+
FmDlgUtils::FmDlgUtils( void )
{
}
@@ -39,7 +40,7 @@
FmDlgUtils::~FmDlgUtils( void )
{
}
-HbAction *FmDlgUtils::executeDialog( HbDialog *dialog, const QString &associatedDrives )
+HbAction *FmDlgUtils::executeDialog( FmDialog *dialog, const QString &associatedDrives )
{
for( int i = 0; i < associatedDrives.length(); i++ ) {
QString drive( associatedDrives[i] + QString( ":/" ) );
@@ -82,8 +83,8 @@
cQuery->setMarkedListItem( selectedIndex );
}
- QString sk1 ( tr ( "ok" ) );
- QString sk2 ( tr ("cancel" ) );
+ QString sk1 ( hbTrId( "txt_common_button_ok" ) );
+ QString sk2 ( hbTrId("txt_common_button_cancel" ) );
if( !sk1.isEmpty() ) {
HbAction *primary = new HbAction( sk1 );
@@ -158,8 +159,8 @@
}
- QString sk1 ( hbTrId( "ok" ) );
- QString sk2 ( hbTrId( "cancel" ) );
+ QString sk1 ( hbTrId( "txt_common_button_ok" ) );
+ QString sk2 ( hbTrId( "txt_common_button_cancel" ) );
if( !sk1.isEmpty() ) {
HbAction *primary = new HbAction( sk1 );
@@ -212,8 +213,8 @@
cQuery->setHeadingWidget( new HbLabel( title ) );
cQuery->setTime( time );
- QString sk1 ( hbTrId( "ok" ) );
- QString sk2 ( hbTrId( "cancel" ) );
+ QString sk1 ( hbTrId( "txt_common_button_ok" ) );
+ QString sk2 ( hbTrId( "txt_common_button_cancel" ) );
if( !sk1.isEmpty() ) {
HbAction *primary = new HbAction( sk1 );
@@ -246,7 +247,7 @@
bool FmDlgUtils::showTextQuery(
const QString& title, QString& text, bool isDimPrimaryActionWhenEmpty, int maxLength,
- const QString &associatedDrives )
+ const QString &associatedDrives, bool isReturnFalseWhenNoTextChanged )
{
bool ret( false );
bool ok ( true ); // SK return (out parameter)
@@ -261,8 +262,8 @@
}
cQuery->setHeadingWidget( new HbLabel( title ) );
- QString sk1 ( hbTrId ( "ok" ) );
- QString sk2 ( hbTrId ( "cancel" ) );
+ QString sk1 ( hbTrId ( "txt_common_button_ok" ) );
+ QString sk2 ( hbTrId ( "txt_common_button_cancel" ) );
if( !sk1.isEmpty() ) {
HbAction *primary = new HbAction( sk1 );
@@ -286,7 +287,14 @@
if( ok ){
QString newName = cQuery->getLineEditText();
- if ( newName != text ){
+ if ( newName == text ){
+ if( isReturnFalseWhenNoTextChanged ) {
+ ret = false;
+ }
+ else {
+ ret = true;
+ }
+ } else {
text = newName;
ret = true;
}
@@ -295,16 +303,19 @@
return ret;
}
-bool FmDlgUtils::showSinglePasswordQuery( const QString &title, QString &pwd, const QString &associatedDrives )
+bool FmDlgUtils::showSinglePasswordQuery( const QString &title, QString &pwd, int maxLength, const QString &associatedDrives )
{
bool ret( false );
FmSingleTextQuery *cQuery = new FmSingleTextQuery( FmSingleTextQuery::DimPrimereActionWhenEmpty,
HbLineEdit::Password );
+ if( maxLength != -1 ){
+ cQuery->setLineEditMaxLength( maxLength );
+ }
cQuery->setHeadingWidget( new HbLabel( title ) );
- QString sk1 ( tr ("ok" ) );
- QString sk2 ( tr ("cancel" ) );
+ QString sk1 ( hbTrId("txt_common_button_ok" ) );
+ QString sk2 ( hbTrId("txt_common_button_cancel" ) );
if( !sk1.isEmpty() ) {
HbAction *primary = new HbAction( sk1 );
@@ -331,16 +342,19 @@
}
bool FmDlgUtils::showMultiPasswordQuery(
- const QString &firstLabel, const QString &secondLabel, QString &pwd, const QString &associatedDrives )
+ const QString &firstLabel, const QString &secondLabel, QString &pwd, int maxLength, const QString &associatedDrives )
{
bool ret( false );
FmMultiTextQuery *cQuery = new FmMultiTextQuery( HbLineEdit::Password );
+ if( maxLength != -1 ){
+ cQuery->setLineEditMaxLength( maxLength );
+ }
cQuery->setFirstLabelText( firstLabel );
cQuery->setSecondLabelText( secondLabel );
- QString sk1 = ( hbTrId( "ok" ) );
- QString sk2 = ( hbTrId( "cancel" ) );
+ QString sk1 = ( hbTrId( "txt_common_button_ok" ) );
+ QString sk2 = ( hbTrId( "txt_common_button_cancel" ) );
if( !sk1.isEmpty() ) {
HbAction *primary = new HbAction( sk1 );
@@ -369,3 +383,35 @@
delete cQuery;
return ret;
}
+
+bool FmDlgUtils::question( const QString &questionText, const QString &primaryButtonText,
+ const QString &secondaryButtonText )
+{
+ FmMessageBox msgBox;
+ return msgBox.question( questionText, primaryButtonText, secondaryButtonText );
+}
+
+void FmDlgUtils::information( const QString &informationText )
+{
+ FmMessageBox msgBox;
+ return msgBox.information( informationText );
+}
+
+QString FmDlgUtils::showBackupDriveQuery( const QString& title )
+{
+ QString ret;
+
+ FmDriveQuery *cQuery = new FmDriveQuery();
+ cQuery->setHeadingWidget( new HbLabel( title ) );
+
+ QString sk = ( hbTrId( "txt_common_button_cancel" ) );
+
+ HbAction *primary = new HbAction( sk );
+ cQuery->setPrimaryAction( primary );
+
+ executeDialog( cQuery, QString() );
+ ret = cQuery->selectedDrive();
+
+ delete cQuery;
+ return ret;
+}