messagingapp/shareui/src/shareuiprivate.cpp
changeset 70 a15d9966050f
parent 52 12db4185673b
equal deleted inserted replaced
61:8ba0afbb4637 70:a15d9966050f
    21 #include <QRegExp>
    21 #include <QRegExp>
    22 #include <QFile>
    22 #include <QFile>
    23 #include <QStringList>
    23 #include <QStringList>
    24 #include <QGraphicsLinearLayout>
    24 #include <QGraphicsLinearLayout>
    25 
    25 
       
    26 #include <QTranslator>
       
    27 #include <QLocale>
       
    28 #include <hbapplication.h>
    26 #include <HbAction>
    29 #include <HbAction>
    27 #include <HbDialog>
    30 #include <HbDialog>
    28 #include <HbLabel>
    31 #include <HbLabel>
    29 #include <HbListView>
    32 #include <HbListView>
    30 #include <HbListViewItem>
    33 #include <HbListViewItem>
    37 #include <xqaiwinterfacedescriptor.h>
    40 #include <xqaiwinterfacedescriptor.h>
    38 
    41 
    39 // USER INCLUDES
    42 // USER INCLUDES
    40 #include "shareuiprivate.h"
    43 #include "shareuiprivate.h"
    41 
    44 
    42 // Localized Constants
    45 #define LOC_TITLE_SHARING_METHODS  hbTrId("txt_share_title_sharing_methods")
    43 //#define LOC_SEND_SELECTED_ITEM  hbTrId("txt_shareui_send_selected_item")
    46 #define LOC_BUTTON_CANCEL       hbTrId("txt_common_button_cancel")
    44 //#define LOC_BUTTON_CANCEL       hbTrId("txt_shareui_button_cancel")
    47 #define LOC_NO_SERVICES         hbTrId("txt_shareui_no_services ")
    45 //#define LOC_NO_SERVICES         hbTrId("txt_shareui_no_services")
    48 #define LOC_SERVICE_ERROR       hbTrId("txt_shareui_service_error")
    46 //#define LOC_NO_FILES            hbTrId("txt_shareui_no_files")
    49 #define LOC_PROTECTED_CONTENT   hbTrId("txt_shareui_protected_content")
    47 //#define LOC_SERVICE_ERROR       hbTrId("txt_shareui_service_error")
    50 #define LOC_NO_FILES            hbTrId("txt_shareui_no_files")
    48 //#define LOC_PROTECTED_CONTENT   hbTrId("txt_shareui_protected_content")
       
    49 
       
    50 #define LOC_SEND_SELECTED_ITEM  hbTrId("Send selected item")
       
    51 #define LOC_BUTTON_CANCEL       hbTrId("Cancel")
       
    52 #define LOC_NO_SERVICES         hbTrId("No services found.")
       
    53 #define LOC_NO_FILES            hbTrId("No files found.")
       
    54 #define LOC_SERVICE_ERROR       hbTrId("Service error.")
       
    55 #define LOC_PROTECTED_CONTENT   hbTrId("Protected content.")
       
    56 
    51 
    57 const QString LIST_ITEM_TITLE("qtc_list_item_title_normal");
    52 const QString LIST_ITEM_TITLE("qtc_list_item_title_normal");
    58 
    53 
    59 /**
    54 /**
    60  * Constructor.
    55  * Constructor.
    62 ShareUiPrivate::ShareUiPrivate()
    57 ShareUiPrivate::ShareUiPrivate()
    63     {
    58     {
    64     mContentItemModel = 0;
    59     mContentItemModel = 0;
    65     mContentListView = 0;
    60     mContentListView = 0;
    66     mSharePopup = 0;
    61     mSharePopup = 0;
       
    62     
       
    63     QString locale = QLocale::system().name();
       
    64     QString path = "z:/resource/qt/translations/";
       
    65         
       
    66     mTranslator = new QTranslator();
       
    67     mTranslator_comm = new QTranslator();
       
    68     
       
    69     bool result = mTranslator->load(path + QString("share_") + locale);
       
    70     result = mTranslator_comm->load(path + QString("common_") + locale);
       
    71     qApp->installTranslator(mTranslator);
       
    72     qApp->installTranslator(mTranslator_comm);
       
    73     
    67     }
    74     }
    68 
    75 
    69 /**
    76 /**
    70  * Destructor.
    77  * Destructor.
    71  */
    78  */
    72 ShareUiPrivate::~ShareUiPrivate()
    79 ShareUiPrivate::~ShareUiPrivate()
    73     {
    80     {
       
    81     delete mTranslator;
       
    82     delete mTranslator_comm;
    74     }
    83     }
    75 
    84 
    76 /**
    85 /**
    77  * Clear the internal data structures
    86  * Clear the internal data structures
    78  */
    87  */
   203     {
   212     {
   204     // Dialog
   213     // Dialog
   205     mSharePopup = new HbDialog();
   214     mSharePopup = new HbDialog();
   206     // make it delete itself on close
   215     // make it delete itself on close
   207     mSharePopup->setAttribute( Qt::WA_DeleteOnClose, true );
   216     mSharePopup->setAttribute( Qt::WA_DeleteOnClose, true );
   208     HbTextItem* heading = new HbTextItem(LOC_SEND_SELECTED_ITEM, mSharePopup);
   217     HbTextItem* heading = new HbTextItem(LOC_TITLE_SHARING_METHODS, mSharePopup);
   209     QColor color = HbColorScheme::color( LIST_ITEM_TITLE );
   218     QColor color = HbColorScheme::color( LIST_ITEM_TITLE );
   210     heading->setTextColor( color );
   219     heading->setTextColor( color );
   211     heading->setAlignment(Qt::AlignCenter);
   220     heading->setAlignment(Qt::AlignCenter);
   212     mSharePopup->setDismissPolicy(HbDialog::TapAnywhere);
   221     mSharePopup->setDismissPolicy(HbDialog::TapAnywhere);
   213     mSharePopup->setHeadingWidget(heading);
   222     mSharePopup->setHeadingWidget(heading);