creator/src/mainview.cpp
branchRCL_3
changeset 19 b3cee849fa46
equal deleted inserted replaced
18:48060abbbeaf 19:b3cee849fa46
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <hbview.h>
       
    20 #include <hbmainwindow.h>
       
    21 #include <hbapplication.h>
       
    22 #include <hblabel.h>
       
    23 #include <hbmenu.h>
       
    24 #include <hbaction.h>
       
    25 #include <hbtextedit.h>
       
    26 
       
    27 #include <QSignalMapper>
       
    28 #include <QGraphicsLinearLayout>
       
    29 
       
    30 #include "notifications.h"
       
    31 #include "enginewrapper.h"
       
    32 #include "mainview.h"
       
    33 #include "hbtoolbar.h"
       
    34 #include "creator.hrh" // for command ids
       
    35 
       
    36 // ---------------------------------------------------------------------------
       
    37 
       
    38 MainView::MainView(HbMainWindow &mainWindow):
       
    39     mMainWindow(mainWindow)
       
    40 {
       
    41 }
       
    42 
       
    43 // ---------------------------------------------------------------------------
       
    44 
       
    45 MainView::~MainView()
       
    46 {
       
    47 	delete mSm;
       
    48 }
       
    49 
       
    50 // ---------------------------------------------------------------------------
       
    51 
       
    52 void MainView::init(HbApplication &app)
       
    53 {
       
    54     mEngineWrapper.init();
       
    55     this->setTitle("Creator");
       
    56     createMenu(app);
       
    57     createMemoryInfoText();
       
    58 }
       
    59 
       
    60 void MainView::createMenu(HbApplication& app)
       
    61 {
       
    62     HbMenu* menu = this->menu();
       
    63 
       
    64     // signal mapper for identifying the different command actions  
       
    65 	// in executeCommand() handler function:
       
    66     mSm = new QSignalMapper(this);
       
    67     connect(mSm, SIGNAL(mapped(int)), this, SLOT(executeMenuCommand(int)));
       
    68     
       
    69     if (menu != NULL) {
       
    70 
       
    71 		// Run script menu item:
       
    72 		mActionRunScript = menu->addAction("Run script"); 
       
    73 		connect(mActionRunScript, SIGNAL( triggered() ), mSm, SLOT(map()));
       
    74 		mSm->setMapping(mActionRunScript, ECmdCreateFromFile);	
       
    75 
       
    76 		// Calendar sub-menu items:
       
    77 		HbMenu* calendarSubMenu = new HbMenu("Calendar");
       
    78 		menu->addMenu(calendarSubMenu);
       
    79 		mActionCalendarAppointments = calendarSubMenu->addAction("Appointments");
       
    80 		mActionCalendarEvents = calendarSubMenu->addAction("Events");
       
    81 		mActionCalendarAnniversaries = calendarSubMenu->addAction("Anniversaries");
       
    82 		mActionCalendarTodos = calendarSubMenu->addAction("Todos");
       
    83 		mActionCalendarReminders = calendarSubMenu->addAction("Reminders");
       
    84 		
       
    85 		connect(mActionCalendarAppointments, SIGNAL( triggered() ), mSm, SLOT(map()));
       
    86 		mSm->setMapping(mActionCalendarAppointments, ECmdCreateCalendarEntryAppointments);
       
    87 
       
    88 		connect(mActionCalendarEvents, SIGNAL( triggered() ), mSm, SLOT(map()));
       
    89 		mSm->setMapping(mActionCalendarEvents, ECmdCreateCalendarEntryEvents);
       
    90 
       
    91 		connect(mActionCalendarAnniversaries, SIGNAL( triggered() ), mSm, SLOT(map()));
       
    92 		mSm->setMapping(mActionCalendarAnniversaries, ECmdCreateCalendarEntryAnniversaries);
       
    93 
       
    94 		connect(mActionCalendarTodos, SIGNAL( triggered() ), mSm, SLOT(map()));
       
    95 		mSm->setMapping(mActionCalendarTodos, ECmdCreateCalendarEntryToDos);
       
    96 
       
    97 		connect(mActionCalendarReminders, SIGNAL( triggered() ), mSm, SLOT(map()));
       
    98 		mSm->setMapping(mActionCalendarReminders, ECmdCreateCalendarEntryReminders);		
       
    99 /*		
       
   100 		// Browser sub-menu items:
       
   101 		HbMenu* browserSubMenu = new HbMenu("Browser");
       
   102 		menu->addMenu(browserSubMenu);
       
   103 		mActionBrowserBookmark = browserSubMenu->addAction("Bookmarks");
       
   104 		mActionBrowserBmarkFolder = browserSubMenu->addAction("Bookmark folders");
       
   105 		mActionBrowserSavedPages = browserSubMenu->addAction("Saved pages");
       
   106 		mActionBrowserSavedPageFolders = browserSubMenu->addAction("Saved page folders");
       
   107 
       
   108 		connect(mActionBrowserBookmark, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   109 		mSm->setMapping(mActionBrowserBookmark, ECmdCreateBrowserBookmarkEntries);
       
   110 
       
   111 		connect(mActionBrowserBmarkFolder, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   112 		mSm->setMapping(mActionBrowserBmarkFolder, ECmdCreateBrowserBookmarkFolderEntries);
       
   113 
       
   114 		connect(mActionBrowserSavedPages, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   115 		mSm->setMapping(mActionBrowserSavedPages, ECmdCreateBrowserSavedPageEntries);
       
   116 
       
   117 		connect(mActionBrowserSavedPageFolders, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   118 		mSm->setMapping(mActionBrowserSavedPageFolders, ECmdCreateBrowserSavedPageFolderEntries);	
       
   119 */
       
   120 		// Files sub-menu items:
       
   121 		HbMenu* filesSubMenu = new HbMenu("Files");
       
   122 		menu->addMenu(filesSubMenu);
       
   123 		
       
   124 		mActionFilesEmptyFolder = filesSubMenu->addAction("Empty folder");
       
   125 		
       
   126 		connect(mActionFilesEmptyFolder, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   127 		mSm->setMapping(mActionFilesEmptyFolder, ECmdCreateFileEntryEmptyFolder);
       
   128 		
       
   129 		mActionFilesJpeg25 = filesSubMenu->addAction("JPEG 25kB");
       
   130 		connect(mActionFilesJpeg25, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   131 		mSm->setMapping(mActionFilesJpeg25, ECmdCreateFileEntryJPEG_25kB);
       
   132 
       
   133 		mActionFilesJpeg200 = filesSubMenu->addAction("JPEG 200kB");
       
   134 		connect(mActionFilesJpeg200, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   135 		mSm->setMapping(mActionFilesJpeg200, ECmdCreateFileEntryJPEG_200kB);
       
   136 
       
   137 		mActionFilesJpeg500 = filesSubMenu->addAction("JPEG 500kB");
       
   138 		connect(mActionFilesJpeg500, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   139 		mSm->setMapping(mActionFilesJpeg500, ECmdCreateFileEntryJPEG_500kB);		
       
   140 
       
   141 		mActionFilesPng15 = filesSubMenu->addAction("PNG 15kB");
       
   142 		connect(mActionFilesPng15, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   143 		mSm->setMapping(mActionFilesPng15, ECmdCreateFileEntryPNG_15kB);
       
   144 		
       
   145 		mActionFilesGif2 = filesSubMenu->addAction("GIF 2kB");
       
   146 		connect(mActionFilesGif2, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   147 		mSm->setMapping(mActionFilesGif2, ECmdCreateFileEntryGIF_2kB);
       
   148 		
       
   149 		mActionFilesBmp25 = filesSubMenu->addAction("BMP 25kB");
       
   150 		connect(mActionFilesBmp25, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   151 		mSm->setMapping(mActionFilesBmp25, ECmdCreateFileEntryBMP_25kB);
       
   152 		
       
   153 		mActionFilesJp265 = filesSubMenu->addAction("JP2 65kB");
       
   154 		connect(mActionFilesJp265, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   155 		mSm->setMapping(mActionFilesJp265, ECmdCreateFileEntryJP2_65kB);
       
   156 		
       
   157 		mActionFilesSvg15 = filesSubMenu->addAction("SVG 15kB");
       
   158 		connect(mActionFilesSvg15, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   159 		mSm->setMapping(mActionFilesSvg15, ECmdCreateFileEntrySVG_15kB);
       
   160 		
       
   161 		mActionFilesTif25 = filesSubMenu->addAction("TIF 25kB");
       
   162 		connect(mActionFilesTif25, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   163 		mSm->setMapping(mActionFilesTif25, ECmdCreateFileEntryTIF_25kB);
       
   164 		
       
   165 		mActionFilesRng1 = filesSubMenu->addAction("RNG 1kB");
       
   166 		connect(mActionFilesRng1, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   167 		mSm->setMapping(mActionFilesRng1, ECmdCreateFileEntryRNG_1kB);		
       
   168 		
       
   169 		mActionFilesMidi10 = filesSubMenu->addAction("MIDI 10kB");
       
   170 		connect(mActionFilesMidi10, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   171 		mSm->setMapping(mActionFilesMidi10, ECmdCreateFileEntryMIDI_10kB);
       
   172 		
       
   173 		mActionFilesWave20 = filesSubMenu->addAction("WAVE 20kB");
       
   174 		connect(mActionFilesWave20, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   175 		mSm->setMapping(mActionFilesWave20, ECmdCreateFileEntryWAV_20kB);
       
   176 
       
   177 		mActionFilesAmr20 = filesSubMenu->addAction("AMR 20kB");
       
   178 		connect(mActionFilesAmr20, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   179 		mSm->setMapping(mActionFilesAmr20, ECmdCreateFileEntryAMR_20kB);		
       
   180 
       
   181 		mActionFilesExcel15 = filesSubMenu->addAction("Excel 15kB");
       
   182 		connect(mActionFilesExcel15, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   183 		mSm->setMapping(mActionFilesExcel15, ECmdCreateFileEntryXLS_15kB);
       
   184 
       
   185 		mActionFilesWord20 = filesSubMenu->addAction("Word 20kB");
       
   186 		connect(mActionFilesWord20, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   187 		mSm->setMapping(mActionFilesWord20, ECmdCreateFileEntryDOC_20kB);		
       
   188 
       
   189 		mActionFilesPPoint40 = filesSubMenu->addAction("PowerPoint 40kB");
       
   190 		connect(mActionFilesPPoint40, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   191 		mSm->setMapping(mActionFilesPPoint40, ECmdCreateFileEntryPPT_40kB);		
       
   192 
       
   193 		mActionFilesText10 = filesSubMenu->addAction("Text 10kB");
       
   194 		connect(mActionFilesText10, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   195 		mSm->setMapping(mActionFilesText10, ECmdCreateFileEntryTXT_10kB);		
       
   196 
       
   197 		mActionFilesText70 = filesSubMenu->addAction("Text 70kB");
       
   198 		connect(mActionFilesText70, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   199 		mSm->setMapping(mActionFilesText70, ECmdCreateFileEntryTXT_70kB);
       
   200 
       
   201 		mActionFilesHtml20 = filesSubMenu->addAction("HTML 20kB");
       
   202 		connect(mActionFilesHtml20, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   203 		mSm->setMapping(mActionFilesHtml20, ECmdCreateFileEntryHTML_20kB);		
       
   204 
       
   205 		mActionFilesMxmf40 = filesSubMenu->addAction("MXMF 40kB");
       
   206 		connect(mActionFilesMxmf40, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   207 		mSm->setMapping(mActionFilesMxmf40, ECmdCreateFileEntryMXMF_40kB);	
       
   208 		
       
   209 		mActionFilesRam1 = filesSubMenu->addAction("RAM 1kB");
       
   210 		connect(mActionFilesRam1, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   211 		mSm->setMapping(mActionFilesRam1, ECmdCreateFileEntryRAM_1kB);			
       
   212 
       
   213 		mActionFilesJad1 = filesSubMenu->addAction("JAD 1kB");
       
   214 		connect(mActionFilesJad1, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   215 		mSm->setMapping(mActionFilesJad1, ECmdCreateFileEntryJAD_1kB);			
       
   216 
       
   217 		mActionFilesJar10 = filesSubMenu->addAction("JAR 10kB");
       
   218 		connect(mActionFilesJar10, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   219 		mSm->setMapping(mActionFilesJar10, ECmdCreateFileEntryJAR_10kB);
       
   220 
       
   221 		mActionFilesVcf1 = filesSubMenu->addAction("VCF 1kB");
       
   222 		connect(mActionFilesVcf1, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   223 		mSm->setMapping(mActionFilesVcf1, ECmdCreateFileEntryVCF_1kB);
       
   224 		
       
   225 		mActionFilesVcs1 = filesSubMenu->addAction("VCS 1kB");
       
   226 		connect(mActionFilesVcs1, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   227 		mSm->setMapping(mActionFilesVcs1, ECmdCreateFileEntryVCS_1kB);
       
   228 		
       
   229 		mActionFilesSisx10 = filesSubMenu->addAction("SISX 10kB");
       
   230 		connect(mActionFilesSisx10, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   231 		mSm->setMapping(mActionFilesSisx10, ECmdCreateFileEntrySISX_10kB);
       
   232 
       
   233 		mActionFiles3Gpp70 = filesSubMenu->addAction("3GPP 70kB");
       
   234 		connect(mActionFiles3Gpp70, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   235 		mSm->setMapping(mActionFiles3Gpp70, ECmdCreateFileEntry3GPP_70kB);
       
   236 
       
   237 		mActionFilesMp3250 = filesSubMenu->addAction("MP3 250kB");
       
   238 		connect(mActionFilesMp3250, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   239 		mSm->setMapping(mActionFilesMp3250, ECmdCreateFileEntryMP3_250kB);	
       
   240 
       
   241 		mActionFilesAAC100 = filesSubMenu->addAction("AAC 100kB");
       
   242 		connect(mActionFilesAAC100, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   243 		mSm->setMapping(mActionFilesAAC100, ECmdCreateFileEntryAAC_100kB);	
       
   244 
       
   245 		mActionFilesSwf15 = filesSubMenu->addAction("SWF 15kB");
       
   246 		connect(mActionFilesSwf15, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   247 		mSm->setMapping(mActionFilesSwf15, ECmdCreateFileEntrySWF_15kB);	
       
   248 
       
   249 		mActionFilesMp4200 = filesSubMenu->addAction("MP4 200kB");
       
   250 		connect(mActionFilesMp4200, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   251 		mSm->setMapping(mActionFilesMp4200, ECmdCreateFileEntryMP4_200kB);	
       
   252 
       
   253 		mActionFilesRm95 = filesSubMenu->addAction("RM 95kB");
       
   254 		connect(mActionFilesRm95, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   255 		mSm->setMapping(mActionFilesRm95, ECmdCreateFileEntryRM_95kB);	
       
   256 
       
   257 		mActionFilesWma50 = filesSubMenu->addAction("WMA 50kB");
       
   258 		connect(mActionFilesWma50, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   259 		mSm->setMapping(mActionFilesWma50, ECmdCreateFileEntryWMA_50kB);			
       
   260 
       
   261 		mActionFilesWmv200 = filesSubMenu->addAction("WMV 200kB");
       
   262 		connect(mActionFilesWmv200, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   263 		mSm->setMapping(mActionFilesWmv200, ECmdCreateFileEntryWMV_200kB);	
       
   264 		
       
   265 		// Logs sub-menu items:	
       
   266 		HbMenu* logsSubMenu = new HbMenu("Logs");
       
   267 		menu->addMenu(logsSubMenu);
       
   268         
       
   269 		mActionLogsMissedCalls = logsSubMenu->addAction("Missed calls");
       
   270 		connect(mActionLogsMissedCalls, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   271 		mSm->setMapping(mActionLogsMissedCalls, ECmdCreateLogEntryMissedCalls);
       
   272 
       
   273 		mActionLogsReceivedCalls = logsSubMenu->addAction("Received calls");
       
   274 		connect(mActionLogsReceivedCalls, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   275 		mSm->setMapping(mActionLogsReceivedCalls, ECmdCreateLogEntryReceivedCalls);
       
   276 
       
   277 		mActionLogsDialledNumbers = logsSubMenu->addAction("Dialled numbers");
       
   278 		connect(mActionLogsDialledNumbers, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   279 		mSm->setMapping(mActionLogsDialledNumbers, ECmdCreateLogEntryDialledNumbers);	
       
   280 
       
   281 		// Messaging sub-menu items:	
       
   282 		HbMenu* messageSubMenu = new HbMenu("Messaging");
       
   283 		menu->addMenu(messageSubMenu);
       
   284         
       
   285 		mActionMessageMailboxes = messageSubMenu->addAction("Mailboxes");
       
   286 		connect(mActionMessageMailboxes, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   287 		mSm->setMapping(mActionMessageMailboxes, ECmdCreateMessagingEntryMailboxes);
       
   288 
       
   289 		mActionMessages = messageSubMenu->addAction("Messages");
       
   290 		connect(mActionMessages, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   291 		mSm->setMapping(mActionMessages, ECmdCreateMessagingEntryMessages);		
       
   292 		
       
   293 		// Misc sub-menu items:	
       
   294 		HbMenu* miscSubMenu = new HbMenu("Misc");
       
   295 		menu->addMenu(miscSubMenu);
       
   296         
       
   297 		//mActionMiscConnection = miscSubMenu->addAction("Connection methods");
       
   298 		//mActionMiscImps = miscSubMenu->addAction("IMPS servers");
       
   299 		mActionMiscNotes = miscSubMenu->addAction("Notes");
       
   300 		//mActionMiscLandmarks = miscSubMenu->addAction("Landmarks");
       
   301 /*    
       
   302 		connect(mActionMiscConnection, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   303 		mSm->setMapping(mActionMiscConnection, ECmdCreateMiscEntryAccessPoints);
       
   304 
       
   305 		connect(mActionMiscImps, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   306 		mSm->setMapping(mActionMiscImps, ECmdCreateMiscEntryIMPSServers);
       
   307 */
       
   308 		connect(mActionMiscNotes, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   309 		mSm->setMapping(mActionMiscNotes, ECmdCreateMiscEntryNotes);
       
   310 /*
       
   311 		connect(mActionMiscLandmarks, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   312 		mSm->setMapping(mActionMiscLandmarks, ECmdCreateMiscEntryLandmarks);
       
   313 */
       
   314 		// Phonebook sub-menu items:	
       
   315 		HbMenu* phonebookSubMenu = new HbMenu("Phonebook");
       
   316 		menu->addMenu(phonebookSubMenu);
       
   317         
       
   318 		mActionPhonebookContacts = phonebookSubMenu->addAction("Contacts");
       
   319 		connect(mActionPhonebookContacts, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   320 		mSm->setMapping(mActionPhonebookContacts, ECmdCreatePhoneBookEntryContacts);
       
   321 
       
   322 		mActionPhonebookGroups = phonebookSubMenu->addAction("Groups");
       
   323 		connect(mActionPhonebookGroups, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   324 		mSm->setMapping(mActionPhonebookGroups, ECmdCreatePhoneBookEntryGroups);	
       
   325 		
       
   326 		// Delete sub-menu items: 
       
   327 		HbMenu* deleteSubMenu = new HbMenu("Delete");
       
   328 		menu->addMenu(deleteSubMenu);
       
   329 
       
   330 		HbMenu* deleteAllSubMenu = new HbMenu("All items");
       
   331 		deleteSubMenu->addMenu(deleteAllSubMenu);
       
   332         
       
   333 		mActionDeleteAllItems = deleteAllSubMenu->addAction("All");
       
   334 		connect(mActionDeleteAllItems, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   335 		mSm->setMapping(mActionDeleteAllItems, ECmdDeleteAllEntries);
       
   336 
       
   337 		mActionDeleteCreatorItems = deleteAllSubMenu->addAction("By Creator");
       
   338 		connect(mActionDeleteCreatorItems, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   339 		mSm->setMapping(mActionDeleteCreatorItems, ECmdDeleteAllCreatorEntries);
       
   340 		
       
   341 		HbMenu* deleteCalendarSubMenu = new HbMenu("Calendar entries");
       
   342 		deleteSubMenu->addMenu(deleteCalendarSubMenu);
       
   343         
       
   344 		mActionDeleteCalAllItems = deleteCalendarSubMenu->addAction("All");
       
   345 		connect(mActionDeleteCalAllItems, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   346 		mSm->setMapping(mActionDeleteCalAllItems, ECmdDeleteCalendarEntries);
       
   347 
       
   348 		mActionDeleteCalCreatorItems = deleteCalendarSubMenu->addAction("By Creator");
       
   349 		connect(mActionDeleteCalCreatorItems, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   350 		mSm->setMapping(mActionDeleteCalCreatorItems, ECmdDeleteCreatorCalendarEntries);
       
   351 /*
       
   352 		HbMenu* deleteBookmarksSubMenu = new HbMenu("Br bookmarks");
       
   353 		deleteSubMenu->addMenu(deleteBookmarksSubMenu);
       
   354         
       
   355 		mActionDeleteBookmarkAllItems = deleteBookmarksSubMenu->addAction("All");
       
   356 		connect(mActionDeleteBookmarkAllItems, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   357 		mSm->setMapping(mActionDeleteBookmarkAllItems, ECmdDeleteBrowserBookmarks);
       
   358 
       
   359 		mActionDeleteBookmarkCreatorItems = deleteBookmarksSubMenu->addAction("By Creator");
       
   360 		connect(mActionDeleteBookmarkCreatorItems, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   361 		mSm->setMapping(mActionDeleteBookmarkCreatorItems, ECmdDeleteCreatorBrowserBookmarks);
       
   362 
       
   363 		HbMenu* deleteBookmarkFoldersSubMenu = new HbMenu("Br bookmark folders");
       
   364 		deleteSubMenu->addMenu(deleteBookmarkFoldersSubMenu);
       
   365         
       
   366 		mActionDeleteBookmarkFolderAllItems = deleteBookmarkFoldersSubMenu->addAction("All");
       
   367 		connect(mActionDeleteBookmarkFolderAllItems, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   368 		mSm->setMapping(mActionDeleteBookmarkFolderAllItems, ECmdDeleteBrowserBookmarkFolders);
       
   369 
       
   370 		mActionDeleteBookmarkFolderCreatorItems = deleteBookmarkFoldersSubMenu->addAction("By Creator");
       
   371 		connect(mActionDeleteBookmarkFolderCreatorItems, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   372 		mSm->setMapping(mActionDeleteBookmarkFolderCreatorItems, ECmdDeleteCreatorBrowserBookmarkFolders);		
       
   373 
       
   374 		HbMenu* deleteSavedPagesSubMenu = new HbMenu("Br saved pages");
       
   375 		deleteSubMenu->addMenu(deleteSavedPagesSubMenu);
       
   376         
       
   377 		mActionDeleteSavedPagesAllItems = deleteSavedPagesSubMenu->addAction("All");
       
   378 		connect(mActionDeleteSavedPagesAllItems, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   379 		mSm->setMapping(mActionDeleteSavedPagesAllItems, ECmdDeleteBrowserSavedPages);
       
   380 
       
   381 		mActionDeleteSavedPagesCreatorItems = deleteSavedPagesSubMenu->addAction("By Creator");
       
   382 		connect(mActionDeleteSavedPagesCreatorItems, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   383 		mSm->setMapping(mActionDeleteSavedPagesCreatorItems, ECmdDeleteCreatorBrowserSavedPages);	
       
   384 
       
   385 		HbMenu* deleteSavedPagesFolderSubMenu = new HbMenu("Br saved page folders");
       
   386 		deleteSubMenu->addMenu(deleteSavedPagesFolderSubMenu);
       
   387         
       
   388 		mActionDeleteSavedPagesFolderAllItems = deleteSavedPagesFolderSubMenu->addAction("All");
       
   389 		connect(mActionDeleteSavedPagesFolderAllItems, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   390 		mSm->setMapping(mActionDeleteSavedPagesFolderAllItems, ECmdDeleteBrowserSavedPageFolders);
       
   391 
       
   392 		mActionDeleteSavedPagesFolderCreatorItems = deleteSavedPagesFolderSubMenu->addAction("By Creator");
       
   393 		connect(mActionDeleteSavedPagesFolderCreatorItems, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   394 		mSm->setMapping(mActionDeleteSavedPagesFolderCreatorItems, ECmdDeleteCreatorBrowserSavedPageFolders);	
       
   395 */
       
   396 		HbMenu* deleteFilesSubMenu = new HbMenu("Files");
       
   397 		deleteSubMenu->addMenu(deleteFilesSubMenu);
       
   398 
       
   399 		mActionDeleteFiles = deleteFilesSubMenu->addAction("By Creator");
       
   400 		connect(mActionDeleteFiles, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   401 		mSm->setMapping(mActionDeleteFiles, ECmdDeleteCreatorFiles);			
       
   402 		
       
   403 		HbMenu* deleteLogsSubMenu = new HbMenu("Logs");
       
   404 		deleteSubMenu->addMenu(deleteLogsSubMenu);
       
   405 
       
   406 		mActionDeleteLogsAll = deleteLogsSubMenu->addAction("All");
       
   407 		connect(mActionDeleteLogsAll, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   408 		mSm->setMapping(mActionDeleteLogsAll, ECmdDeleteLogs);
       
   409 		
       
   410 		mActionDeleteLogsByCreator = deleteLogsSubMenu->addAction("By Creator");
       
   411 		connect(mActionDeleteLogsByCreator, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   412 		mSm->setMapping(mActionDeleteLogsByCreator, ECmdDeleteCreatorLogs);
       
   413 
       
   414 		HbMenu* deleteMessagesSubMenu = new HbMenu("Messages");
       
   415 		deleteSubMenu->addMenu(deleteMessagesSubMenu);
       
   416 
       
   417 		mActionDeleteMessagesAll = deleteMessagesSubMenu->addAction("All");
       
   418 		connect(mActionDeleteMessagesAll, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   419 		mSm->setMapping(mActionDeleteMessagesAll, ECmdDeleteMessages);
       
   420 		
       
   421 		mActionDeleteMessagesByCreator = deleteMessagesSubMenu->addAction("By Creator");
       
   422 		connect(mActionDeleteMessagesByCreator, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   423 		mSm->setMapping(mActionDeleteMessagesByCreator, ECmdDeleteCreatorMessages);
       
   424 /*
       
   425 		HbMenu* deleteConnMethsSubMenu = new HbMenu("Connection methods");
       
   426 		deleteSubMenu->addMenu(deleteConnMethsSubMenu);
       
   427 
       
   428 		mActionDeleteConnMethsAll = deleteConnMethsSubMenu->addAction("All");
       
   429 		connect(mActionDeleteConnMethsAll, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   430 		mSm->setMapping(mActionDeleteConnMethsAll, ECmdDeleteMessages);
       
   431 		
       
   432 		mActionDeleteConnMethsByCreator = deleteConnMethsSubMenu->addAction("By Creator");
       
   433 		connect(mActionDeleteConnMethsByCreator, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   434 		mSm->setMapping(mActionDeleteConnMethsByCreator, ECmdDeleteCreatorMessages);
       
   435 
       
   436 		HbMenu* deleteImpsSubMenu = new HbMenu("IMPS servers");
       
   437 		deleteSubMenu->addMenu(deleteImpsSubMenu);
       
   438 
       
   439 		mActionDeleteImpsAll = deleteImpsSubMenu->addAction("All");
       
   440 		connect(mActionDeleteImpsAll, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   441 		mSm->setMapping(mActionDeleteImpsAll, ECmdDeleteIMPSs);
       
   442 		
       
   443 		mActionDeleteImpsByCreator = deleteImpsSubMenu->addAction("By Creator");
       
   444 		connect(mActionDeleteImpsByCreator, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   445 		mSm->setMapping(mActionDeleteImpsByCreator, ECmdDeleteCreatorIMPSs);		
       
   446 */		
       
   447 		HbMenu* deleteNotesSubMenu = new HbMenu("Notes");
       
   448 		deleteSubMenu->addMenu(deleteNotesSubMenu);
       
   449 
       
   450 		mActionDeleteNotes = deleteNotesSubMenu->addAction("All");
       
   451 		connect(mActionDeleteNotes, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   452 		mSm->setMapping(mActionDeleteNotes, ECmdDeleteNotes);
       
   453 /*
       
   454 		HbMenu* deleteLandmarksSubMenu = new HbMenu("Landmarks");
       
   455 		deleteSubMenu->addMenu(deleteLandmarksSubMenu);
       
   456 
       
   457 		mActionDeleteLandmarksAll = deleteLandmarksSubMenu->addAction("All");
       
   458 		connect(mActionDeleteLandmarksAll, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   459 		mSm->setMapping(mActionDeleteLandmarksAll, ECmdDeleteLandmarks);
       
   460 		
       
   461 		mActionDeleteLandmarksByCreator = deleteLandmarksSubMenu->addAction("By Creator");
       
   462 		connect(mActionDeleteLandmarksByCreator, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   463 		mSm->setMapping(mActionDeleteLandmarksByCreator, ECmdDeleteCreatorLandmarks);
       
   464 */
       
   465 		HbMenu* deleteContactsSubMenu = new HbMenu("Contacts");
       
   466 		deleteSubMenu->addMenu(deleteContactsSubMenu);
       
   467 
       
   468 		mActionDeleteContactsAll = deleteContactsSubMenu->addAction("All");
       
   469 		connect(mActionDeleteContactsAll, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   470 		mSm->setMapping(mActionDeleteContactsAll, ECmdDeleteContacts);
       
   471 		
       
   472 		mActionDeleteContactsByCreator = deleteContactsSubMenu->addAction("By Creator");
       
   473 		connect(mActionDeleteContactsByCreator, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   474 		mSm->setMapping(mActionDeleteContactsByCreator, ECmdDeleteCreatorContacts);
       
   475 
       
   476 		HbMenu* deleteContactGroupsSubMenu = new HbMenu("Contact groups");
       
   477 		deleteSubMenu->addMenu(deleteContactGroupsSubMenu);
       
   478 
       
   479 		mActionDeleteContactGroupsAll = deleteContactGroupsSubMenu->addAction("All");
       
   480 		connect(mActionDeleteContactGroupsAll, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   481 		mSm->setMapping(mActionDeleteContactGroupsAll, ECmdDeleteContactGroups);
       
   482 		
       
   483 		mActionDeleteContactGroupsByCreator = deleteContactGroupsSubMenu->addAction("By Creator");
       
   484 		connect(mActionDeleteContactGroupsByCreator, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   485 		mSm->setMapping(mActionDeleteContactGroupsByCreator, ECmdDeleteCreatorContactGroups);		
       
   486 /*		
       
   487 		// select random data file:
       
   488 		mActionSelectRandomFile = menu->addAction("Select random data file"); 
       
   489 		connect(mActionSelectRandomFile, SIGNAL( triggered() ), mSm, SLOT(map()));
       
   490 		mSm->setMapping(mActionSelectRandomFile, ECmdSelectRandomDataFile);	
       
   491 */		
       
   492 		// About & exit menu items:
       
   493 		mActionAbout = menu->addAction("About Creator");
       
   494         connect(mActionAbout, SIGNAL( triggered() ), this, SLOT( showAboutPopup() ) );
       
   495     
       
   496         mActionExit = menu->addAction("Exit");
       
   497         connect(mActionExit, SIGNAL(triggered()), &app, SLOT( quit() ) );
       
   498 
       
   499         this->setMenu(menu);
       
   500     }
       
   501 }
       
   502 
       
   503 // ---------------------------------------------------------------------------
       
   504 
       
   505 void MainView::createMemoryInfoText()
       
   506 {
       
   507     QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical, this);
       
   508 
       
   509     // get memory details from engine;
       
   510     mMemoryDetails = mEngineWrapper.GetMemoryDetails();
       
   511 	
       
   512     QList<MemoryDetails> memDet = mEngineWrapper.GetMemoryDetailsList();
       
   513     
       
   514     if (layout != NULL) 
       
   515     	{
       
   516 		HbLabel* edit = new HbLabel(this);
       
   517         //HbTextEdit* edit = new HbTextEdit(this);
       
   518         if(edit != NULL) 
       
   519         	{
       
   520         QString text = QString("<BR><BR>Free RAM Memory:<BR> %1 of %2 kB").arg(mMemoryDetails.mRamFree).arg(mMemoryDetails.mRamSize);	
       
   521         //QString text = QString("\n\nFree RAM Memory:\n %1 of %2 kB").arg(mMemoryDetails.mRamFree).arg(mMemoryDetails.mRamSize);
       
   522 			for(int i=0 ; i < memDet.count() ; i++ )
       
   523 				{
       
   524 			text += QString("<BR><BR>Free %1: Memory:<BR> %2 of %3 kB").arg(memDet[i].mDriveLetter).arg(memDet[i].mFree).arg(memDet[i].mSize);//text += QString("\n\nFree %1: Memory:\n %2 of %3 kB").arg(memDet[i].mDriveLetter).arg(memDet[i].mFree).arg(memDet[i].mSize);
       
   525 				}
       
   526 			edit->setTextWrapping(Hb::TextWordWrap);
       
   527 			edit->setHtml(text);
       
   528 			//edit->setPlainText(text);
       
   529                 	
       
   530             //edit->setReadOnly(true);
       
   531             //edit->setCursorHidden(true);
       
   532             edit->setAttribute(Qt::WA_InputMethodEnabled, false);
       
   533             layout->addItem(edit);
       
   534             layout->setContentsMargins(5, 5, 5, 5);
       
   535             this->setLayout(layout);
       
   536         	}
       
   537         
       
   538     }
       
   539     
       
   540 }
       
   541 
       
   542 
       
   543 // ---------------------------------------------------------------------------
       
   544 
       
   545 void MainView::showAboutPopup()
       
   546 {
       
   547 	Notifications::about();
       
   548 
       
   549 }
       
   550 
       
   551 // ---------------------------------------------------------------------------
       
   552 
       
   553 void MainView::executeMenuCommand(int cmd)
       
   554 {
       
   555     switch (cmd) {
       
   556 		case ECmdCreateFromFile:
       
   557 		case ECmdCreateCalendarEntryAppointments:
       
   558 		case ECmdCreateCalendarEntryEvents:
       
   559 		case ECmdCreateCalendarEntryAnniversaries:
       
   560 		case ECmdCreateCalendarEntryToDos:
       
   561 		case ECmdCreateCalendarEntryReminders:
       
   562 		case ECmdCreateBrowserBookmarkEntries:
       
   563         case ECmdCreateBrowserBookmarkFolderEntries:
       
   564         case ECmdCreateBrowserSavedPageEntries:
       
   565         case ECmdCreateBrowserSavedPageFolderEntries: 
       
   566 		case ECmdCreateFileEntryEmptyFolder:
       
   567 	    case ECmdCreateFileEntry3GPP_70kB:
       
   568 	    case ECmdCreateFileEntryAAC_100kB:
       
   569 	    case ECmdCreateFileEntryAMR_20kB:
       
   570 	    case ECmdCreateFileEntryBMP_25kB:
       
   571 	    case ECmdCreateFileEntryDeck_1kB:
       
   572 	    case ECmdCreateFileEntryDOC_20kB:
       
   573 	    case ECmdCreateFileEntryGIF_2kB:
       
   574 	    case ECmdCreateFileEntryHTML_20kB:
       
   575 	    case ECmdCreateFileEntryJAD_1kB:
       
   576 	    case ECmdCreateFileEntryJAR_10kB:
       
   577 	    case ECmdCreateFileEntryJP2_65kB:
       
   578 	    case ECmdCreateFileEntryJPEG_200kB:
       
   579 	    case ECmdCreateFileEntryJPEG_25kB:
       
   580 	    case ECmdCreateFileEntryJPEG_500kB:
       
   581 	    case ECmdCreateFileEntryMIDI_10kB:
       
   582 	    case ECmdCreateFileEntryMP3_250kB:
       
   583 	    case ECmdCreateFileEntryMP4_200kB:
       
   584 	    case ECmdCreateFileEntryMXMF_40kB:
       
   585 	    case ECmdCreateFileEntryPNG_15kB:
       
   586 	    case ECmdCreateFileEntryPPT_40kB:
       
   587 	    case ECmdCreateFileEntryRAM_1kB:
       
   588 	    case ECmdCreateFileEntryRM_95kB:
       
   589 	    case ECmdCreateFileEntryRNG_1kB:
       
   590 	    case ECmdCreateFileEntrySVG_15kB:
       
   591 	    case ECmdCreateFileEntrySWF_15kB:
       
   592 	    case ECmdCreateFileEntryTIF_25kB:
       
   593 	    case ECmdCreateFileEntryTXT_10kB:
       
   594 	    case ECmdCreateFileEntryTXT_70kB:
       
   595 	    case ECmdCreateFileEntryVCF_1kB:
       
   596 	    case ECmdCreateFileEntryVCS_1kB:
       
   597 	    case ECmdCreateFileEntryWAV_20kB:
       
   598 	    case ECmdCreateFileEntryXLS_15kB:
       
   599 	    case ECmdCreateFileEntrySISX_10kB:
       
   600 	    case ECmdCreateFileEntryWMA_50kB:
       
   601 	    case ECmdCreateFileEntryWMV_200kB:
       
   602 	    case ECmdCreateLogEntryMissedCalls:
       
   603 	    case ECmdCreateLogEntryReceivedCalls:
       
   604 	    case ECmdCreateLogEntryDialledNumbers:
       
   605 	    case ECmdCreateMessagingEntryMailboxes:
       
   606 	    case ECmdCreateMessagingEntryMessages:		
       
   607         case ECmdCreateMiscEntryAccessPoints:
       
   608 		case ECmdCreateMiscEntryIMPSServers:
       
   609 		case ECmdCreateMiscEntryNotes:
       
   610 		case ECmdCreateMiscEntryLandmarks:		
       
   611 		case ECmdCreatePhoneBookEntryContacts:
       
   612 	    case ECmdCreatePhoneBookEntryGroups:
       
   613 		case ECmdDeleteAllEntries:
       
   614 	    case ECmdDeleteAllCreatorEntries:
       
   615 	    case ECmdDeleteContacts:
       
   616         case ECmdDeleteCreatorContacts:
       
   617         case ECmdDeleteContactGroups:
       
   618         case ECmdDeleteCreatorContactGroups:
       
   619         case ECmdDeleteCalendarEntries:
       
   620         case ECmdDeleteCreatorCalendarEntries:
       
   621         case ECmdDeleteBrowserBookmarks:
       
   622         case ECmdDeleteCreatorBrowserBookmarks:
       
   623         case ECmdDeleteBrowserBookmarkFolders:
       
   624         case ECmdDeleteCreatorBrowserBookmarkFolders:
       
   625         case ECmdDeleteBrowserSavedPages:
       
   626         case ECmdDeleteCreatorBrowserSavedPages:
       
   627         case ECmdDeleteBrowserSavedPageFolders:
       
   628         case ECmdDeleteCreatorBrowserSavedPageFolders:
       
   629         case ECmdDeleteCreatorFiles:
       
   630         case ECmdDeleteLogs:
       
   631         case ECmdDeleteCreatorLogs:
       
   632         case ECmdDeleteMessages:
       
   633         case ECmdDeleteCreatorMessages:
       
   634         case ECmdDeleteMailboxes:
       
   635         case ECmdDeleteCreatorMailboxes:
       
   636         case ECmdDeleteIAPs:
       
   637         case ECmdDeleteCreatorIAPs:
       
   638         case ECmdDeleteIMPSs:
       
   639         case ECmdDeleteCreatorIMPSs:
       
   640         case ECmdDeleteNotes:
       
   641         case ECmdDeleteLandmarks:
       
   642         case ECmdDeleteCreatorLandmarks:
       
   643 		case ECmdSelectRandomDataFile: {
       
   644 			mEngineWrapper.ExecuteOptionsMenuCommand(cmd);
       
   645             break;
       
   646         }
       
   647         default: {
       
   648             Notifications::error(QString("Unsupported command: %1").arg(cmd));
       
   649             break;
       
   650         }
       
   651     }
       
   652 }
       
   653 
       
   654 void MainView::closeApp()
       
   655 {
       
   656 	qApp->quit();
       
   657 }
       
   658 
       
   659 // ---------------------------------------------------------------------------