phonebookui/pbkcommonui/src/cntdetaileditor.cpp
changeset 71 7cc7d74059f9
parent 65 ae724a111993
equal deleted inserted replaced
65:ae724a111993 71:7cc7d74059f9
    33 #include <cntdebug.h>
    33 #include <cntdebug.h>
    34 #include <hbscrollarea.h>
    34 #include <hbscrollarea.h>
    35 #include <hbscrollbar.h>
    35 #include <hbscrollbar.h>
    36 #include <hbdevicenotificationdialog.h>
    36 #include <hbdevicenotificationdialog.h>
    37 #include <hbparameterlengthlimiter.h>
    37 #include <hbparameterlengthlimiter.h>
       
    38 #include <hbshrinkingvkbhost.h>
    38 
    39 
    39 #include <QApplication>
    40 #include <QApplication>
    40 #include <QTimer>
    41 #include <QTimer>
    41 
    42 
    42 const char *CNT_DETAILEDITOR_XML = ":/xml/contacts_detail_editor.docml";
    43 const char *CNT_DETAILEDITOR_XML = ":/xml/contacts_detail_editor.docml";
    49     mView(NULL),
    50     mView(NULL),
    50     mLoader(NULL),   
    51     mLoader(NULL),   
    51     mViewManager(NULL),
    52     mViewManager(NULL),
    52     mEditorFactory(NULL),
    53     mEditorFactory(NULL),
    53     mCancel(NULL),
    54     mCancel(NULL),
    54     mSaveManager(NULL)
    55     mSaveManager(NULL),
       
    56     mVirtualKeyboard(NULL)
    55 {
    57 {
    56     bool ok;
    58     bool ok;
    57     document()->load(CNT_DETAILEDITOR_XML, &ok);
    59     document()->load(CNT_DETAILEDITOR_XML, &ok);
    58     if (!ok) {
    60     if (!ok) {
    59         qFatal("Unable to read %S", CNT_DETAILEDITOR_XML);
    61         qFatal("Unable to read %S", CNT_DETAILEDITOR_XML);
    86     mLoader = NULL;
    88     mLoader = NULL;
    87     delete mEditorFactory;
    89     delete mEditorFactory;
    88     mEditorFactory = NULL;
    90     mEditorFactory = NULL;
    89     delete mSaveManager;
    91     delete mSaveManager;
    90     mSaveManager = NULL;
    92     mSaveManager = NULL;
       
    93     delete mVirtualKeyboard;
       
    94     mVirtualKeyboard = NULL;
    91 }
    95 }
    92 
    96 
    93 void CntDetailEditor::setViewId( int aId )
    97 void CntDetailEditor::setViewId( int aId )
    94 {
    98 {
    95     mId = aId;
    99     mId = aId;
   161     }
   165     }
   162     
   166     
   163     mDataForm->setVerticalScrollBarPolicy(HbScrollArea::ScrollBarAsNeeded); 
   167     mDataForm->setVerticalScrollBarPolicy(HbScrollArea::ScrollBarAsNeeded); 
   164     mDataForm->setScrollingStyle(HbScrollArea::PanWithFollowOn);
   168     mDataForm->setScrollingStyle(HbScrollArea::PanWithFollowOn);
   165     mDataForm->verticalScrollBar()->setInteractive(true);
   169     mDataForm->verticalScrollBar()->setInteractive(true);
       
   170     
       
   171     mVirtualKeyboard = new HbShrinkingVkbHost(mView);
       
   172         
       
   173     connect(mVirtualKeyboard, SIGNAL(keypadOpened()), this, SLOT(handleKeypadOpen()));
       
   174     connect(mVirtualKeyboard, SIGNAL(keypadClosed()), this, SLOT(handleKeypadClosed()));
   166 }
   175 }
   167 
   176 
   168 void CntDetailEditor::deactivate()
   177 void CntDetailEditor::deactivate()
   169 {
   178 {
   170     QContactManager& mgr = mEngine->contactManager(SYMBIAN_BACKEND);
   179     QContactManager& mgr = mEngine->contactManager(SYMBIAN_BACKEND);
   228         {
   237         {
   229             edit->setInputMethodHints( Qt::ImhNoPredictiveText );
   238             edit->setInputMethodHints( Qt::ImhNoPredictiveText );
   230             
   239             
   231             if (modelItem->contentWidgetData( "preferDigits" ).toBool())
   240             if (modelItem->contentWidgetData( "preferDigits" ).toBool())
   232             {
   241             {
   233                 edit->setInputMethodHints( Qt::ImhPreferNumbers );
   242                 edit->setInputMethodHints( Qt::ImhPreferNumbers | Qt::ImhNoPredictiveText );
   234             }
   243             }
   235             
   244             
   236             objName = mDataFormModel->detail().definitionName() + " line edit %1";
   245             objName = mDataFormModel->detail().definitionName() + " line edit %1";
   237         }
   246         }
   238         
   247         
   368         QTimer::singleShot(0, this, SLOT(showRootView()));
   377         QTimer::singleShot(0, this, SLOT(showRootView()));
   369     }
   378     }
   370     CNT_EXIT
   379     CNT_EXIT
   371 }
   380 }
   372 
   381 
       
   382 void CntDetailEditor::handleKeypadOpen()
       
   383 {
       
   384     CNT_ENTRY
       
   385     
       
   386   // enable full screen
       
   387     mView->setContentFullScreen(true);
       
   388     CNT_EXIT
       
   389 }
       
   390 
       
   391 void CntDetailEditor::handleKeypadClosed()
       
   392 {
       
   393     CNT_ENTRY
       
   394     // disable full screen
       
   395     mView->setContentFullScreen(false);
       
   396     CNT_EXIT
       
   397 }
       
   398 
   373 // End of File
   399 // End of File