clock/clockui/clockalarmeditor/src/clockalarmeditor.cpp
changeset 68 a5a1242fd2e8
parent 58 ef813d54df51
child 77 b0711afde476
equal deleted inserted replaced
58:ef813d54df51 68:a5a1242fd2e8
   222 		alarmDayIndex += mStartOfWeek;
   222 		alarmDayIndex += mStartOfWeek;
   223 		if(alarmDayIndex >= KDaysInWeek){
   223 		if(alarmDayIndex >= KDaysInWeek){
   224 		   alarmDayIndex -= KDaysInWeek;
   224 		   alarmDayIndex -= KDaysInWeek;
   225 		}
   225 		}
   226 	}
   226 	}
       
   227 	
       
   228 	if(mAlarmId) {
       
   229 		mAlarmClient.deleteAlarm(mAlarmId);
       
   230 	}
   227 
   231 
   228 	setAlarm(
   232 	setAlarm(
   229 			mAlarmTimeItem->contentWidgetData("text").toString(),
   233 			mAlarmTimeItem->contentWidgetData("text").toString(),
   230 			mAlarmDescription->contentWidgetData("text").toString(),
   234 			mAlarmDescription->contentWidgetData("text").toString(),
   231 			mAlarmOccurenceItem->contentWidgetData("currentIndex").toInt(),
   235 			mAlarmOccurenceItem->contentWidgetData("currentIndex").toInt(),
   243 	Handles delete action on the editor. Deletes the alarm.
   247 	Handles delete action on the editor. Deletes the alarm.
   244  */
   248  */
   245 void ClockAlarmEditor::handleDeleteAction()
   249 void ClockAlarmEditor::handleDeleteAction()
   246 {
   250 {
   247 	OstTraceFunctionEntry0( CLOCKALARMEDITOR_HANDLEDELETEACTION_ENTRY );
   251 	OstTraceFunctionEntry0( CLOCKALARMEDITOR_HANDLEDELETEACTION_ENTRY );
       
   252 	if(mAlarmId) {
       
   253 		mAlarmClient.deleteAlarm(mAlarmId);
       
   254 	}
   248 	closeAlarmEditor();
   255 	closeAlarmEditor();
   249 	OstTraceFunctionExit0( CLOCKALARMEDITOR_HANDLEDELETEACTION_EXIT );
   256 	OstTraceFunctionExit0( CLOCKALARMEDITOR_HANDLEDELETEACTION_EXIT );
   250 }
   257 }
   251 
   258 
   252 /*!
   259 /*!
   360 		}
   367 		}
   361 	} else {
   368 	} else {
   362 		// Check if the Alarm days item is added.
   369 		// Check if the Alarm days item is added.
   363 		// Remove if already added.
   370 		// Remove if already added.
   364 		if (mAlarmDayItemInserted) {
   371 		if (mAlarmDayItemInserted) {
       
   372 			mAlarmEditorForm->removeConnection(
       
   373 								mAlarmDayItem, SIGNAL(currentIndexChanged(int)),
       
   374 								this, SLOT(handleDayChanged(int)));
   365 			mAlarmEditorModel->removeItem(mAlarmDayItem);
   375 			mAlarmEditorModel->removeItem(mAlarmDayItem);
   366 			mAlarmDayItemInserted = false;
   376 			mAlarmDayItemInserted = false;
   367 		}
   377 		}
   368 	}
   378 	}
   369 	OstTraceFunctionExit0( DUP1_CLOCKALARMEDITOR_HANDLEOCCURENCECHANGED_EXIT );
   379 	OstTraceFunctionExit0( DUP1_CLOCKALARMEDITOR_HANDLEOCCURENCECHANGED_EXIT );
   522 		HbLineEdit *editor = static_cast<HbLineEdit *>(
   532 		HbLineEdit *editor = static_cast<HbLineEdit *>(
   523 				viewItem->dataItemContentWidget());
   533 				viewItem->dataItemContentWidget());
   524 		
   534 		
   525 		editor->setSelection(0, 0);
   535 		editor->setSelection(0, 0);
   526 		if (editor->text().isEmpty()) {
   536 		if (editor->text().isEmpty()) {
   527 	        editor->setText(hbTrId("txt_clk_formlabel_val_alarm"));
   537 	    	mAlarmDescription->setContentWidgetData(
       
   538 	    			"text", hbTrId("txt_clk_formlabel_val_alarm"));
   528         }
   539         }
   529 
   540 
   530 	}
   541 	}
   531 }
   542 }
   532 
   543 
   690 
   701 
   691 	// If editor state is a reset alarm, then its an already existing alarm
   702 	// If editor state is a reset alarm, then its an already existing alarm
   692 	// get the alarm details and fill it in mAlarmInfo.
   703 	// get the alarm details and fill it in mAlarmInfo.
   693 	if (mAlarmId) {
   704 	if (mAlarmId) {
   694 		mAlarmClient.getAlarmInfo(mAlarmId, mAlarmInfo);
   705 		mAlarmClient.getAlarmInfo(mAlarmId, mAlarmInfo);
   695 		mAlarmClient.deleteAlarm(mAlarmId);
       
   696 	}
   706 	}
   697 	
   707 	
   698 	// Set the value for previous alarm time.
   708 	// Set the value for previous alarm time.
   699 	mOldAlarmTime = mAlarmInfo.nextDueTime;
   709 	mOldAlarmTime = mAlarmInfo.nextDueTime;
   700 	
   710