calendarui/caleneditor/src/caleneditorcustomitem.cpp
changeset 50 579cc610882e
parent 49 5de72ea7a065
child 58 ef813d54df51
equal deleted inserted replaced
49:5de72ea7a065 50:579cc610882e
    53 /*!
    53 /*!
    54 	Constructor.
    54 	Constructor.
    55 	\param parent The parent object.
    55 	\param parent The parent object.
    56  */
    56  */
    57 CalenEditorCustomItem::CalenEditorCustomItem(QGraphicsItem *parent)
    57 CalenEditorCustomItem::CalenEditorCustomItem(QGraphicsItem *parent)
    58 :HbDataFormViewItem(parent)
    58 :HbDataFormViewItem(parent),
       
    59  mPushButtonTime(NULL),
       
    60  mPushButtonDate(NULL),
       
    61  mRepeatUntilWidget(NULL),
       
    62  mReminderTimeWidget(NULL),
       
    63  mDatePicker(NULL),
       
    64  mTimePicker(NULL)
    59 {
    65 {
    60 	mMinDate = CalenDateUtils::minTime().date();
    66 	mMinDate = CalenDateUtils::minTime().date();
    61 	mMaxDate = CalenDateUtils::maxTime().date();
    67 	mMaxDate = CalenDateUtils::maxTime().date();
    62 	mMinTime.setHMS(0,0,0,0);
    68 	mMinTime.setHMS(0,0,0,0);
    63 	mMaxTime.setHMS(23,59,59,999);
    69 	mMaxTime.setHMS(23,59,59,999);
   153 			
   159 			
   154 			connect(mLocationPushButton, SIGNAL(clicked()), this, 
   160 			connect(mLocationPushButton, SIGNAL(clicked()), this, 
   155 												SLOT(launchLocationPicker()));
   161 												SLOT(launchLocationPicker()));
   156 			connect(mLocationLineEdit, SIGNAL(textChanged(const QString)),
   162 			connect(mLocationLineEdit, SIGNAL(textChanged(const QString)),
   157 						this, SLOT(handleLocationTextChange(const QString)));
   163 						this, SLOT(handleLocationTextChange(const QString)));
       
   164 						
       
   165 			connect(mLocationLineEdit, SIGNAL(editingFinished()),
       
   166 			            this, SLOT(handleEditingFinished()));
       
   167 			
   158 			return widgetLocation;
   168 			return widgetLocation;
   159 		}
   169 		}
   160 		
   170 		
   161 		case RepeatUntilOffset:
   171 		case RepeatUntilOffset:
   162 		{
   172 		{
   211 		{
   221 		{
   212 			locationString.append(selectedLocation.mCity);
   222 			locationString.append(selectedLocation.mCity);
   213 			locationString.append(',');
   223 			locationString.append(',');
   214 		}
   224 		}
   215 		locationString.append(selectedLocation.mCountry);
   225 		locationString.append(selectedLocation.mCountry);
   216 		emit locationTextChanged(locationString);
   226 		emit locationTextChanged(locationString, selectedLocation.mLatitude, selectedLocation.mLongitude);
   217 		mLocationLineEdit->setText(locationString );
   227 		mLocationLineEdit->setText(locationString );
   218     }
   228     }
   219 }
   229 }
   220 
   230 
   221 /*!
   231 /*!
   282 {
   292 {
   283 	emit locationTextChanged(location);
   293 	emit locationTextChanged(location);
   284 }
   294 }
   285 
   295 
   286 /*!
   296 /*!
       
   297 	Handles the location editing finished
       
   298  */
       
   299 void CalenEditorCustomItem::handleEditingFinished()
       
   300 {
       
   301     emit locationEditingFinished();
       
   302 }
       
   303 
       
   304 /*!
   287 	Launches the date picker
   305 	Launches the date picker
   288  */
   306  */
   289 void CalenEditorCustomItem::handleDate()
   307 void CalenEditorCustomItem::handleDate()
   290 {
   308 {
   291 	// Create a popup with datepicker for the user to select date.
   309 	// Create a popup with datepicker for the user to select date.
   307 		mDatePicker = NULL;
   325 		mDatePicker = NULL;
   308 	}
   326 	}
   309 	mDatePicker = new HbDateTimePicker(mDate, popUp);
   327 	mDatePicker = new HbDateTimePicker(mDate, popUp);
   310 	mDatePicker->setMinimumDate(mMinDate);
   328 	mDatePicker->setMinimumDate(mMinDate);
   311 	mDatePicker->setMaximumDate(mMaxDate);
   329 	mDatePicker->setMaximumDate(mMaxDate);
   312 	
   330 	mDatePicker->setDate(mDate);
   313 	popUp->setContentWidget(mDatePicker);
   331 	popUp->setContentWidget(mDatePicker);
   314 	HbAction *okAction = new HbAction(hbTrId("txt_common_button_ok"));
   332 	HbAction *okAction = new HbAction(hbTrId("txt_common_button_ok"), popUp);
   315 	popUp->addAction(okAction);
   333 	popUp->addAction(okAction);
   316 	connect(okAction, SIGNAL(triggered()), this, SLOT(saveDate()));
   334 	connect(okAction, SIGNAL(triggered()), this, SLOT(saveDate()));
   317 	popUp->addAction(new HbAction(hbTrId("txt_common_button_cancel")));
   335 	popUp->addAction(new HbAction(hbTrId("txt_common_button_cancel"), popUp));
   318 	popUp->open();
   336 	popUp->open();
   319 }
   337 }
   320 
   338 
   321 /*!
   339 /*!
   322 	Launches the time picker
   340 	Launches the time picker
   349 		mTimePicker->setDisplayFormat("hh:mm");
   367 		mTimePicker->setDisplayFormat("hh:mm");
   350 	}
   368 	}
   351 	mTimePicker->setTime(mTime);
   369 	mTimePicker->setTime(mTime);
   352 	popUp->setContentWidget(mTimePicker);
   370 	popUp->setContentWidget(mTimePicker);
   353 
   371 
   354 	HbAction *okAction = new HbAction(hbTrId("txt_common_button_ok"));
   372 	HbAction *okAction = new HbAction(hbTrId("txt_common_button_ok"), popUp);
   355 	popUp->addAction(okAction);
   373 	popUp->addAction(okAction);
   356 	connect(okAction, SIGNAL(triggered()), this, SLOT(saveTime()));
   374 	connect(okAction, SIGNAL(triggered()), this, SLOT(saveTime()));
   357 	popUp->addAction(new HbAction(hbTrId("txt_common_button_cancel"), popUp));
   375 	popUp->addAction(new HbAction(hbTrId("txt_common_button_cancel"), popUp));
   358 	popUp->open();
   376 	popUp->open();
   359 }
   377 }