phonebookui/phonebookservices/tsrc/qtpbkservicestestapp/main.cpp
changeset 46 efe85016a067
parent 27 de1630741fbe
child 50 77bc263e1626
child 59 a642906a277a
equal deleted inserted replaced
40:b46a585f6909 46:efe85016a067
    18 #include <hbapplication.h>
    18 #include <hbapplication.h>
    19 #include <hbpushbutton.h>
    19 #include <hbpushbutton.h>
    20 #include <hbmainwindow.h>
    20 #include <hbmainwindow.h>
    21 #include <qapplication.h>
    21 #include <qapplication.h>
    22 #include <hbview.h>
    22 #include <hbview.h>
    23 #include <QGraphicsLinearLayout>
    23 #include <hbscrollarea.h>
       
    24 #include <QGraphicsGridLayout>
    24 
    25 
    25 #include "testpbkservices.h"
    26 #include "testpbkservices.h"
    26 
    27 
    27 int main(int argc, char *argv[])
    28 int main(int argc, char *argv[])
    28 {
    29 {
    31 
    32 
    32     // Main window widget.
    33     // Main window widget.
    33     // Includes decorators such as signal strength and battery life indicator.
    34     // Includes decorators such as signal strength and battery life indicator.
    34     HbMainWindow mainWindow;
    35     HbMainWindow mainWindow;
    35 
    36 
    36     testPbkServices *service=new testPbkServices(&mainWindow);
    37     testPbkServices *service = new testPbkServices(&mainWindow);
    37 
    38 
    38     HbView* view = new HbView();
    39     HbView* view = new HbView();
    39     view->setTitle("QtPhonebook Test Application");
    40     view->setTitle("QtPhonebook Test Application");
    40 
    41 
    41     QGraphicsLinearLayout* mainLayout = new QGraphicsLinearLayout(Qt::Vertical);
    42     QGraphicsGridLayout* mainLayout = new QGraphicsGridLayout();
    42 
    43 
    43     HbPushButton *button1 = new HbPushButton("Launch Fetch");
    44     HbPushButton* button = NULL;
    44     QObject::connect(button1, SIGNAL(pressed()), service, SLOT(launchFetch()));
    45     int row = 0;
    45 
    46 
    46     HbPushButton *button2 = new HbPushButton("Launch SMS fetch");
    47     // FETCH =================================================================
    47     QObject::connect(button2, SIGNAL(pressed()), service, SLOT(launchSmsFilteredFetch()));
       
    48 
    48 
    49     HbPushButton *button3 = new HbPushButton("Launch EMAIL fetch");
    49     button = new HbPushButton("Multi Fetch");
    50     QObject::connect(button3, SIGNAL(pressed()), service, SLOT(launchEmailFilteredFetch()));
    50     QObject::connect(button, SIGNAL(pressed()), service, SLOT(launchMultiFetch()));
       
    51     mainLayout->addItem(button, row, 0);
       
    52     button = new HbPushButton("old");
       
    53     QObject::connect(button, SIGNAL(pressed()), service, SLOT(launchMultiFetch_old()));
       
    54     mainLayout->addItem(button, row, 1);
       
    55     row++;
    51 
    56 
    52     HbPushButton *button4 = new HbPushButton("Launch editor with number");
    57     button = new HbPushButton("Multi fetch SMS");
    53     QObject::connect(button4, SIGNAL(pressed()), service, SLOT(launchEditorNumber()));
    58     QObject::connect(button, SIGNAL(pressed()), service, SLOT(launchMultiFetch_sms()));
       
    59     mainLayout->addItem(button, row, 0);
       
    60     button = new HbPushButton("old");
       
    61     QObject::connect(button, SIGNAL(pressed()), service, SLOT(launchMultiFetch_sms_old()));
       
    62     mainLayout->addItem(button, row, 1);
       
    63     row++;
       
    64 
       
    65     button = new HbPushButton("Multi fetch EMAIL");
       
    66     QObject::connect(button, SIGNAL(pressed()), service, SLOT(launchMultiFetch_email()));
       
    67     mainLayout->addItem(button, row, 0);
       
    68     button = new HbPushButton("old");
       
    69     QObject::connect(button, SIGNAL(pressed()), service, SLOT(launchMultiFetch_email_old()));
       
    70     mainLayout->addItem(button, row, 1);
       
    71     row++;
       
    72 
       
    73     button = new HbPushButton("Single fetch");
       
    74     QObject::connect(button, SIGNAL(pressed()), service, SLOT(launchSingleFetch()));
       
    75     mainLayout->addItem(button, row, 0);
       
    76     button = new HbPushButton("old");
       
    77     QObject::connect(button, SIGNAL(pressed()), service, SLOT(launchSingleFetch_old()));
       
    78     mainLayout->addItem(button, row, 1);
       
    79     row++;
       
    80 
       
    81     // EDIT - create new =====================================================
       
    82 
       
    83     button = new HbPushButton("Edit create new - number");
       
    84     QObject::connect(button, SIGNAL(pressed()), service, SLOT(launchEditCreateNew_number()));
       
    85     mainLayout->addItem(button, row, 0);
       
    86     button = new HbPushButton("old");
       
    87     QObject::connect(button, SIGNAL(pressed()), service, SLOT(launchEditCreateNew_number_old()));
       
    88     mainLayout->addItem(button, row, 1);
       
    89     row++;
       
    90 
       
    91     button = new HbPushButton("Edit create new - email");
       
    92     QObject::connect(button, SIGNAL(pressed()), service, SLOT(launchEditCreateNew_email()));
       
    93     mainLayout->addItem(button, row, 0);
       
    94     button = new HbPushButton("old");
       
    95     QObject::connect(button, SIGNAL(pressed()), service, SLOT(launchEditCreateNew_email_old()));
       
    96     mainLayout->addItem(button, row, 1);
       
    97     row++;
       
    98 
       
    99     button = new HbPushButton("Edit create new - onlineAccount");
       
   100     QObject::connect(button, SIGNAL(pressed()), service, SLOT(launchEditCreateNew_onlineAccount()));
       
   101     mainLayout->addItem(button, row, 0);
       
   102     button = new HbPushButton("old");
       
   103     QObject::connect(button, SIGNAL(pressed()), service, SLOT(launchEditCreateNew_onlineAccount_old()));
       
   104     mainLayout->addItem(button, row, 1);
       
   105     row++;
       
   106 
       
   107     button = new HbPushButton("Launch editor with vCard");
       
   108     QObject::connect(button, SIGNAL(pressed()), service, SLOT(launchEditorVCard()));
       
   109     mainLayout->addItem(button, row, 0);
       
   110     button = new HbPushButton("old");
       
   111     QObject::connect(button, SIGNAL(pressed()), service, SLOT(launchEditorVCard_old()));
       
   112     mainLayout->addItem(button, row, 1);
       
   113     row++;
       
   114 
       
   115     // EDIT - update existing ================================================
       
   116 
       
   117     button = new HbPushButton("Edit/update existing - number");
       
   118     QObject::connect(button, SIGNAL(pressed()), service, SLOT(launchEditUpdateExisting_number()));
       
   119     mainLayout->addItem(button, row, 0);
       
   120     button = new HbPushButton("old");
       
   121     QObject::connect(button, SIGNAL(pressed()), service, SLOT(launchEditUpdateExisting_number_old()));
       
   122     mainLayout->addItem(button, row, 1);
       
   123     row++;
       
   124 
       
   125     button = new HbPushButton("Edit/update existing - email");
       
   126     QObject::connect(button, SIGNAL(pressed()), service, SLOT(launchEditUpdateExisting_email()));
       
   127     mainLayout->addItem(button, row, 0);
       
   128     button = new HbPushButton("old");
       
   129     QObject::connect(button, SIGNAL(pressed()), service, SLOT(launchEditUpdateExisting_email_old()));
       
   130     mainLayout->addItem(button, row, 1);
       
   131     row++;
       
   132 
       
   133     button = new HbPushButton("Edit/update existing - onlineAccount");
       
   134     QObject::connect(button, SIGNAL(pressed()), service, SLOT(launchEditUpdateExisting_onlineAccount()));
       
   135     mainLayout->addItem(button, row, 0);
       
   136     button = new HbPushButton("old");
       
   137     QObject::connect(button, SIGNAL(pressed()), service, SLOT(launchEditUpdateExisting_onlineAccount_old()));
       
   138     mainLayout->addItem(button, row, 1);
       
   139     row++;
       
   140 
       
   141     // CONTACT CARD ==========================================================
       
   142 
       
   143     button = new HbPushButton("Launch contact card");
       
   144     QObject::connect(button, SIGNAL(pressed()), service, SLOT(launchContactCard()));
       
   145     mainLayout->addItem(button, row, 0);
       
   146     button = new HbPushButton("old");
       
   147     QObject::connect(button, SIGNAL(pressed()), service, SLOT(launchContactCard_old()));
       
   148     mainLayout->addItem(button, row, 1);
       
   149     row++;
       
   150 
       
   151     button = new HbPushButton("Launch contact card with number");
       
   152     QObject::connect(button, SIGNAL(pressed()), service, SLOT(launchContactCardNumber()));
       
   153     mainLayout->addItem(button, row, 0);
       
   154     button = new HbPushButton("old");
       
   155     QObject::connect(button, SIGNAL(pressed()), service, SLOT(launchContactCardNumber_old()));
       
   156     mainLayout->addItem(button, row, 1);
       
   157     row++;
       
   158 
       
   159     button = new HbPushButton("Launch contact card with email");
       
   160     QObject::connect(button, SIGNAL(pressed()), service, SLOT(launchContactCardEmail()));
       
   161     mainLayout->addItem(button, row, 0);
       
   162     button = new HbPushButton("old");
       
   163     QObject::connect(button, SIGNAL(pressed()), service, SLOT(launchContactCardEmail_old()));
       
   164     mainLayout->addItem(button, row, 1);
       
   165     row++;
       
   166 
       
   167     button = new HbPushButton("Launch contact card with online account");
       
   168     QObject::connect(button, SIGNAL(pressed()), service, SLOT(launchContactCardOnlineAccount()));
       
   169     mainLayout->addItem(button, row, 0);
       
   170     button = new HbPushButton("old");
       
   171     QObject::connect(button, SIGNAL(pressed()), service, SLOT(launchContactCardOnlineAccount_old()));
       
   172     mainLayout->addItem(button, row, 1);
       
   173     row++;
    54     
   174     
    55     HbPushButton *button5 = new HbPushButton("Launch editor with email");
   175     QGraphicsWidget *graphicsWidget = new QGraphicsWidget();
    56     QObject::connect(button5, SIGNAL(pressed()), service, SLOT(launchEditorEmail()));
   176     graphicsWidget->setLayout(mainLayout);
    57     
   177     HbScrollArea *scrollArea = new HbScrollArea();
    58     HbPushButton *button6 = new HbPushButton("Launch editor with online account");
   178     scrollArea->setContentWidget(graphicsWidget);
    59     QObject::connect(button6, SIGNAL(pressed()), service, SLOT(launchEditorOnlineAccount()));
   179     view->setWidget(scrollArea);
    60     
       
    61     HbPushButton *button7 = new HbPushButton("Update contact with number");
       
    62     QObject::connect(button7, SIGNAL(pressed()), service, SLOT(launchUpdateEditorNumber()));
       
    63     
       
    64     HbPushButton *button8 = new HbPushButton("Update contact with email");
       
    65     QObject::connect(button8, SIGNAL(pressed()), service, SLOT(launchUpdateEditorEmail()));
       
    66     
       
    67     HbPushButton *button9 = new HbPushButton("Update contact with online account");
       
    68     QObject::connect(button9, SIGNAL(pressed()), service, SLOT(launchUpdateEditorOnlineAccount()));
       
    69 
       
    70     HbPushButton *button10 = new HbPushButton("Launch single fetch");
       
    71     QObject::connect(button10, SIGNAL(pressed()), service, SLOT(launchSingleFetch()));
       
    72     	
       
    73     HbPushButton *button11 = new HbPushButton("Launch editor with vCard");
       
    74     QObject::connect(button11, SIGNAL(pressed()), service, SLOT(launchEditorVCard()));
       
    75 
       
    76     mainLayout->addItem(button1);
       
    77     mainLayout->addItem(button2);
       
    78     mainLayout->addItem(button3);
       
    79     mainLayout->addItem(button4);
       
    80     mainLayout->addItem(button5);
       
    81     mainLayout->addItem(button6);
       
    82     mainLayout->addItem(button7);
       
    83     mainLayout->addItem(button8);
       
    84     mainLayout->addItem(button9);
       
    85     mainLayout->addItem(button10);
       
    86     mainLayout->addItem(button11);
       
    87     
       
    88     
       
    89     view->setLayout(mainLayout);
       
    90 
       
    91     mainWindow.addView(view);
   180     mainWindow.addView(view);
       
   181     row++;
    92 
   182 
    93     // Show widget
   183     // Show widget
    94     mainWindow.show();
   184     mainWindow.show();
    95 
   185 
    96     // Enter event loop
   186     // Enter event loop