examples/ForumNokia/DBMS/inc/DBMSAppui.h

00001 /*
00002  * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
00003  *    
00004  * Redistribution and use in source and binary forms, with or without
00005  * modification, are permitted provided that the following conditions are met:
00006  *    
00007  *  * Redistributions of source code must retain the above copyright notice, this
00008  *    list of conditions and the following disclaimer.
00009  *  * Redistributions in binary form must reproduce the above copyright notice,
00010  *    this list of conditions and the following disclaimer in the documentation
00011  *    and/or other materials provided with the distribution.
00012  *  * Neither the name of Nokia Corporation nor the names of its contributors
00013  *    may be used to endorse or promote products derived from this software
00014  *    without specific prior written permission.
00015  *    
00016  *    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00017  *    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00018  *    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00019  *    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00020  *    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00021  *    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00022  *    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00023  *    CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00024  *    OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00025  *    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00026  *    
00027  *    Description:  
00028  */
00029 
00030 #ifndef __DBMSAPPUI_H__
00031 #define __DBMSAPPUI_H__
00032 
00033 #include <aknappui.h>
00034 #include "DBMSEngine.h"
00035 
00036 // Forward declarations
00037 class CDBMSAppView;
00038 class CDBMSListboxView;
00039 class CDBMSEditorView;
00040 class CDesC16ArrayFlat;
00041 
00042 // Name of database file in the application directory
00043 _LIT(KDatabaseFile,"DBMS.dat");
00044 
00045 
00057 class CDBMSAppUi : public CAknAppUi
00058     {
00059 public:
00060 
00068     void ConstructL();
00069 
00077     CDBMSAppUi();
00078 
00079 
00085     ~CDBMSAppUi();
00086 
00087 
00088 public: // from CAknAppUi
00089 
00102     void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane);
00103 
00104 
00112     void HandleCommandL(TInt aCommand);
00113     
00118     void HandleStatusPaneSizeChange();
00119 
00120 private: // Menu command helpers
00121 
00128     void OpenDatabaseL();
00129 
00136     void CreateDatabaseL();
00137 
00143     void RemoveDatabaseL();
00144 
00151     void CloseDatabaseL();
00152 
00158     void ShowBookEditorViewL();
00159 
00169     void AddBookL(TBool aUseSql);
00170 
00179     void RemoveBookL();
00180 
00186     void RemoveAllBooksL();
00187 
00193     void UpdateBookTitleL();
00194 
00201     void ShowAllBooksL();
00202 
00209     void SearchBooksL();
00210 
00218     void IndexFindL();
00219 
00226     void AddDateColumnL();
00227 
00235     void RemoveDateColumnL();
00236 
00242     void ShowColumnsL();
00243 
00244 private: // Other helpers
00245 
00251     TFileName ApplicationDriveAndPathL() const;
00252     
00258         TFileName DatabaseDriveAndPathL() const;
00259 
00261     enum TViewId
00262         {
00263         ENone,          // On the startup there is no view
00264         EMainView,      // Main view initially visible.
00265         EListView,  // Showing list of books
00266         EColumnsView,   // Showing columns of Books table
00267         EEditorView // For adding a new book to database
00268         };
00269 
00275     void ChangeViewL(TViewId aNewView);
00276 
00282     void ShowNoteL(const TDesC& aMessage) const;
00283 
00291     CDesCArrayFlat* TitlesArrayL(const CDesCArrayFlat* aFullInfoArray) const;
00292 
00298     TBool QueryTextL(TDesC& aPrompt, TDes& aResultText) const;
00299 
00300 private:
00301 
00302     TViewId iCurrentView;
00303 
00305     CDBMSAppView* iAppView;
00306 
00308     CDBMSListboxView* iListboxView;
00309 
00311     CDBMSEditorView* iBookEditorView;
00312 
00314     CBookDb* iBookDb;
00315 
00317     TFileName     iDatabaseFile;
00318     };
00319 
00320 #endif // __DBMSAPPUI_H__
00321 

Generated by  doxygen 1.6.2