ui/commandhandlers/commoncommandhandlers/src/glxcommandhandleraddtocontainer.cpp
changeset 26 c499df2dbb33
parent 24 99ad1390cd33
child 29 2c833fc9e98f
equal deleted inserted replaced
24:99ad1390cd33 26:c499df2dbb33
    35 #include <hbpushbutton.h>
    35 #include <hbpushbutton.h>
    36 #include <QGraphicsGridLayout>
    36 #include <QGraphicsGridLayout>
    37 #include <hbdialog.h>
    37 #include <hbdialog.h>
    38 #include <hbmessagebox.h>
    38 #include <hbmessagebox.h>
    39 
    39 
       
    40 #include "glxlocalisationstrings.h"
       
    41 
    40 #include "OstTraceDefinitions.h"
    42 #include "OstTraceDefinitions.h"
    41 #ifdef OST_TRACE_COMPILER_IN_USE
    43 #ifdef OST_TRACE_COMPILER_IN_USE
    42 #include "glxcommandhandleraddtocontainerTraces.h"
    44 #include "glxcommandhandleraddtocontainerTraces.h"
    43 #endif
    45 #endif
    44 
    46 
    45 
    47 
    46 TInt GlxCommandHandlerAddToContainer::iSelectionCount = 0;
    48 TInt GlxCommandHandlerAddToContainer::iSelectionCount = 0;
    47 
    49 
    48 const TInt KSelectionPopupListHierarchy = 5;
    50 const TInt KSelectionPopupListHierarchy = 5;
       
    51 const TInt KListPrefferedHeight = 400;
    49 
    52 
    50 GlxQueryContentWidget::GlxQueryContentWidget(QGraphicsItem* parent) :
    53 GlxQueryContentWidget::GlxQueryContentWidget(QGraphicsItem* parent) :
    51     QGraphicsWidget(parent), mButton(0), mListView(0), mGrid(0)
    54     QGraphicsWidget(parent), mButton(0), mListView(0), mGrid(0)
    52     {
    55     {
    53     OstTraceFunctionEntry0( DUP1_GLXQUERYCONTENTWIDGET_GLXQUERYCONTENTWIDGET_ENTRY );
    56     OstTraceFunctionEntry0( DUP1_GLXQUERYCONTENTWIDGET_GLXQUERYCONTENTWIDGET_ENTRY );
    55     mGrid->setContentsMargins(0, 0, 0, 0);
    58     mGrid->setContentsMargins(0, 0, 0, 0);
    56 
    59 
    57     mButton = new HbPushButton("New Item");
    60     mButton = new HbPushButton("New Item");
    58     mListView = new HbListView(this);
    61     mListView = new HbListView(this);
    59     mListView->setSelectionMode(HbAbstractItemView::MultiSelection);
    62     mListView->setSelectionMode(HbAbstractItemView::MultiSelection);
       
    63     mListView->setPreferredHeight(KListPrefferedHeight);
    60 
    64 
    61     mGrid->addItem(mButton, 0, 0);
    65     mGrid->addItem(mButton, 0, 0);
    62     mGrid->addItem(mListView, 1, 0);
    66     mGrid->addItem(mListView, 1, 0);
    63     setLayout(mGrid); //ownership transfered
    67     setLayout(mGrid); //ownership transfered
    64 
    68 
   147 
   151 
   148         command = TGlxCommandFactory::AddToContainerCommandLC(*sourceItems,
   152         command = TGlxCommandFactory::AddToContainerCommandLC(*sourceItems,
   149                 *mTargetContainers);
   153                 *mTargetContainers);
   150         CleanupStack::Pop(command);
   154         CleanupStack::Pop(command);
   151         mNewMediaAdded = false;
   155         mNewMediaAdded = false;
       
   156         }
       
   157     else
       
   158         {
       
   159         MGlxMediaList::UnmarkAllL(aMediaList);
   152         }
   160         }
   153 
   161 
   154     MGlxMediaList::UnmarkAllL(*targetMediaList);
   162     MGlxMediaList::UnmarkAllL(*targetMediaList);
   155     targetMediaList->Close();
   163     targetMediaList->Close();
   156     CleanupStack::PopAndDestroy(sourceItems);
   164     CleanupStack::PopAndDestroy(sourceItems);
   179 
   187 
   180     connect(view->mButton, SIGNAL(released ()), &popup, SLOT(close()));
   188     connect(view->mButton, SIGNAL(released ()), &popup, SLOT(close()));
   181     connect(view->mButton, SIGNAL(released ()), this, SLOT(createNewMedia()));
   189     connect(view->mButton, SIGNAL(released ()), this, SLOT(createNewMedia()));
   182 
   190 
   183 
   191 
   184     HbAction *primary = new HbAction("OK");
   192     HbAction *primary = new HbAction(GLX_BUTTON_OK);
   185     popup.setPrimaryAction(primary);
   193     popup.setPrimaryAction(primary);
   186 
   194 
   187     HbAction *secondary = new HbAction("Cancel");
   195     HbAction *secondary = new HbAction(GLX_BUTTON_CANCEL);
   188     popup.setSecondaryAction(secondary);
   196     popup.setSecondaryAction(secondary);
   189     
   197     
   190     popup.setContentWidget(view); //ownership transfer
   198     popup.setContentWidget(view); //ownership transfer
   191     view->mListView->show();
   199     view->mListView->show();
   192     
   200     
   255     OstTraceFunctionExit0( GLXCOMMANDHANDLERADDTOCONTAINER_CREATENEWMEDIA_EXIT );
   263     OstTraceFunctionExit0( GLXCOMMANDHANDLERADDTOCONTAINER_CREATENEWMEDIA_EXIT );
   256     }
   264     }
   257 
   265 
   258 QString GlxCommandHandlerAddToContainer::CompletionTextL() const
   266 QString GlxCommandHandlerAddToContainer::CompletionTextL() const
   259     {
   267     {
   260     return QString("Item added!");
   268 	return QString();	
   261     }
   269     }
   262 
   270 
   263 QString GlxCommandHandlerAddToContainer::ProgressTextL() const
   271 QString GlxCommandHandlerAddToContainer::ProgressTextL() const
   264     {
   272     {
   265     return QString("Adding album...");
   273     return QString("Adding album...");