ui/commandhandlers/commoncommandhandlers/src/glxcommandhandlernewmedia.cpp
changeset 26 c499df2dbb33
parent 24 99ad1390cd33
child 29 2c833fc9e98f
equal deleted inserted replaced
24:99ad1390cd33 26:c499df2dbb33
    22 #include <glxcommandhandlers.hrh>
    22 #include <glxcommandhandlers.hrh>
    23 #include <glxattributecontext.h>
    23 #include <glxattributecontext.h>
    24 #include <glxattributeretriever.h>
    24 #include <glxattributeretriever.h>
    25 #include <glxfetchcontextremover.h>
    25 #include <glxfetchcontextremover.h>
    26 #include <glxcollectionpluginalbums.hrh>
    26 #include <glxcollectionpluginalbums.hrh>
    27 
    27 #include <glxcommondialogs.h>
    28 #include <hbinputdialog.h>
    28 #include <hbinputdialog.h>
    29 #include <hblabel.h>
    29 #include <hblabel.h>
    30 #include <hbmessagebox.h>
    30 #include <hbmessagebox.h>
    31 #include "OstTraceDefinitions.h"
    31 #include "OstTraceDefinitions.h"
    32 #ifdef OST_TRACE_COMPILER_IN_USE
    32 #ifdef OST_TRACE_COMPILER_IN_USE
    33 #include "glxcommandhandlernewmediaTraces.h"
    33 #include "glxcommandhandlernewmediaTraces.h"
    34 #endif
    34 #endif
    35 #include <hbaction.h>
    35 #include <hbaction.h>
    36 
       
    37 GlxTextInputDialog::GlxTextInputDialog()
       
    38     {
       
    39     }
       
    40 
       
    41 GlxTextInputDialog::~GlxTextInputDialog()
       
    42     {
       
    43     }
       
    44 
       
    45 QString GlxTextInputDialog::getText(const QString &label,
       
    46         const QString &text, bool *ok)
       
    47     {
       
    48     mDialog = new HbInputDialog();
       
    49     mDialog->setPromptText(label);
       
    50     mDialog->setInputMode(HbInputDialog::TextInput);
       
    51     mDialog->setValue(text);
       
    52     connect(mDialog->lineEdit(0), SIGNAL( textChanged (const QString &) ),
       
    53             this, SLOT( textChanged (const QString &)));
       
    54     HbAction* action = mDialog->exec();
       
    55     QString retText = NULL;
       
    56     if (action == mDialog->secondaryAction())
       
    57         { //Cancel was pressed
       
    58         if (ok)
       
    59             {
       
    60             *ok = false;
       
    61             }
       
    62         }
       
    63     else
       
    64         { //OK was pressed
       
    65         if (ok)
       
    66             {
       
    67             *ok = true;
       
    68             }
       
    69         retText = mDialog->value().toString().trimmed();
       
    70         }
       
    71     disconnect(mDialog->lineEdit(0), SIGNAL( textChanged (const QString &) ),
       
    72             this, SLOT( textChanged (const QString &)));
       
    73     delete mDialog;
       
    74     mDialog = NULL;
       
    75     return retText;
       
    76     }
       
    77 
       
    78 void GlxTextInputDialog::textChanged(const QString &text)
       
    79     {
       
    80     if (text.trimmed().isEmpty())
       
    81         {
       
    82         mDialog->primaryAction()->setEnabled(false);
       
    83         }
       
    84     else
       
    85         {
       
    86         mDialog->primaryAction()->setEnabled(true);
       
    87         }
       
    88     }
       
    89 
       
    90 
    36 
    91 GlxCommandHandlerNewMedia::GlxCommandHandlerNewMedia() :
    37 GlxCommandHandlerNewMedia::GlxCommandHandlerNewMedia() :
    92     iNewMediaCreationError(KErrNone), iNewMediaItemTitle(0) , mShowConfirmation(false)
    38     iNewMediaCreationError(KErrNone), iNewMediaItemTitle(0) , mShowConfirmation(false)
    93     {
    39     {
    94     OstTraceFunctionEntry0( GLXCOMMANDHANDLERNEWMEDIA_GLXCOMMANDHANDLERNEWMEDIA_ENTRY );
    40     OstTraceFunctionEntry0( GLXCOMMANDHANDLERNEWMEDIA_GLXCOMMANDHANDLERNEWMEDIA_ENTRY );
   332 
   278 
   333 }
   279 }
   334 
   280 
   335 QString GlxCommandHandlerNewMedia::CompletionTextL() const
   281 QString GlxCommandHandlerNewMedia::CompletionTextL() const
   336     {
   282     {
       
   283     return QString();
       
   284     }
       
   285 
       
   286 QString GlxCommandHandlerNewMedia::ProgressTextL() const
       
   287     {
   337     if (!mShowConfirmation)
   288     if (!mShowConfirmation)
   338         {
   289         {
   339         return QString("Album added");
   290         return QString("Adding album...");
   340         }
   291         }
   341     return QString();
   292     return QString();
   342     }
   293     }
   343 
   294 
   344 QString GlxCommandHandlerNewMedia::ProgressTextL() const
       
   345     {
       
   346     if (!mShowConfirmation)
       
   347         {
       
   348         return QString("Adding album...");
       
   349         }
       
   350     return QString();
       
   351     }
       
   352