notes/notesui/noteseditor/src/noteseditor_p.cpp
changeset 45 b6db4fd4947b
parent 23 fd30d51f876b
child 55 2c54b51f39c4
child 58 ef813d54df51
equal deleted inserted replaced
23:fd30d51f876b 45:b6db4fd4947b
    16 *
    16 *
    17 */
    17 */
    18 
    18 
    19 // System includes
    19 // System includes
    20 #include <QDateTime>
    20 #include <QDateTime>
    21 #include <QTranslator>
       
    22 #include <HbApplication>
       
    23 #include <HbInstance>
    21 #include <HbInstance>
    24 #include <HbMainWindow>
    22 #include <HbMainWindow>
    25 #include <HbView>
    23 #include <HbView>
    26 #include <HbNotificationDialog>
    24 #include <HbNotificationDialog>
    27 #include <HbExtendedLocale>
    25 #include <HbExtendedLocale>
       
    26 #include <HbTranslator>
    28 
    27 
    29 // User includes
    28 // User includes
    30 #include "noteseditor.h"
    29 #include "noteseditor.h"
    31 #include "noteseditor_p.h"
    30 #include "noteseditor_p.h"
    32 #include "notesnoteeditor.h"
    31 #include "notesnoteeditor.h"
    47 	\param parent QObject pointer.
    46 	\param parent QObject pointer.
    48  */
    47  */
    49 NotesEditorPrivate::NotesEditorPrivate(AgendaUtil *agendaUtil, QObject *parent)
    48 NotesEditorPrivate::NotesEditorPrivate(AgendaUtil *agendaUtil, QObject *parent)
    50 :QObject(parent),
    49 :QObject(parent),
    51  mSaveEntry(true),
    50  mSaveEntry(true),
       
    51  mTranslator(0),
    52  mNoteId(0)
    52  mNoteId(0)
    53 {
    53 {
    54 	// First get the q-pointer.
    54 	// First get the q-pointer.
    55 	q_ptr = static_cast<NotesEditor *> (parent);
    55 	q_ptr = static_cast<NotesEditor *> (parent);
       
    56 	
       
    57 	mTranslator = new HbTranslator("notes");
       
    58 	mTranslator->loadCommon();
    56 
    59 
    57 	// Here we check if the agendautil passed by the client is 0. If so, then we
    60 	// Here we check if the agendautil passed by the client is 0. If so, then we
    58 	// construct our own.
    61 	// construct our own.
    59 	if (!agendaUtil) {
    62 	if (!agendaUtil) {
    60 		mAgendaUtil = new AgendaUtil(this);
    63 		mAgendaUtil = new AgendaUtil(this);
    67 	// Here we register for changes in the DB.
    70 	// Here we register for changes in the DB.
    68 	connect(
    71 	connect(
    69 			mAgendaUtil, SIGNAL(entriesChanged(QList<ulong> )),
    72 			mAgendaUtil, SIGNAL(entriesChanged(QList<ulong> )),
    70 			this, SLOT(handleEntriesChanged(QList<ulong> )));
    73 			this, SLOT(handleEntriesChanged(QList<ulong> )));
    71 
    74 
    72 
       
    73 	mTranslator = new QTranslator;
       
    74 	int success=mTranslator->load("notes",":/translations");
       
    75 
       
    76 	HbApplication::instance()->installTranslator(mTranslator);
       
    77 }
    75 }
    78 
    76 
    79 /*!
    77 /*!
    80 	Destructor.
    78 	Destructor.
    81  */
    79  */
    84 	if (mOwnsAgendaUtil) {
    82 	if (mOwnsAgendaUtil) {
    85 		delete mAgendaUtil;
    83 		delete mAgendaUtil;
    86 		mAgendaUtil = 0;
    84 		mAgendaUtil = 0;
    87 	}
    85 	}
    88 
    86 
    89 	HbApplication::instance()->removeTranslator(mTranslator);
       
    90 	if (mTranslator) {
    87 	if (mTranslator) {
    91 		delete mTranslator;
    88 		delete mTranslator;
    92 		mTranslator = 0;
    89 		mTranslator = 0;
    93 	}
    90 	}
    94 }
    91 }
   563 			}
   560 			}
   564 		} else {
   561 		} else {
   565 			if (isTodoEdited()) {
   562 			if (isTodoEdited()) {
   566 				status = mAgendaUtil->updateEntry(mModifiedNote);
   563 				status = mAgendaUtil->updateEntry(mModifiedNote);
   567 				mNoteId = mModifiedNote.id();
   564 				mNoteId = mModifiedNote.id();
   568 				if (status) {
   565 			}
   569 					showNotification(
   566 		}
   570 							hbTrId("txt_notes_dpopinfo_todo_note_saved"));
   567 		if (status) {
   571 				}
   568 			showNotification(
   572 			}
   569 					hbTrId("txt_notes_dpopinfo_todo_note_saved"));
   573 		}
   570 		}
   574 	}
   571 	}
   575 
   572 
   576 	return status;
   573 	return status;
   577 }
   574 }