KOEventPopupMenu::KOEventPopupMenu()
  : mCopyToCalendarMenu( 0 ), mMoveToCalendarMenu( 0 )
{
  mCalendar = 0;
  mCurrentIncidence = 0;
  mCurrentDate = QDate();
  mHasAdditionalItems = false;

  addAction( KOGlobals::self()->smallIcon( "document-preview" ), i18n( "&Show" ),
             this, SLOT( popupShow() ) );
  mEditOnlyItems.append(
    addAction( KOGlobals::self()->smallIcon( "document-edit" ), i18n( "&Edit..." ),
               this, SLOT( popupEdit() ) ) );
#ifndef KORG_NOPRINTER
  mEditOnlyItems.append( addSeparator() );
  addAction( KOGlobals::self()->smallIcon( "document-print" ), i18n( "&Print..." ),
             this, SLOT( print() ) );
  QAction *preview = addAction( KOGlobals::self()->smallIcon( "document-print-preview" ), i18n( "Print Previe&w..." ),
             this, SLOT( printPreview() ) );
  preview->setEnabled( !KMimeTypeTrader::self()->query("application/pdf", "KParts/ReadOnlyPart").isEmpty() );

#endif
  //------------------------------------------------------------------------
  mEditOnlyItems.append( addSeparator() );
  mEditOnlyItems.append( addAction( KOGlobals::self()->smallIcon( "edit-cut" ),
                                    i18nc( "cut this event", "C&ut" ),
                                    this, SLOT(popupCut()) ) );
  mEditOnlyItems.append( addAction( KOGlobals::self()->smallIcon( "edit-copy" ),
                                    i18nc( "copy this event", "&Copy" ),
                                    this, SLOT(popupCopy()) ) );
  // paste is always possible
  mEditOnlyItems.append( addAction( KOGlobals::self()->smallIcon( "edit-paste" ),
                                    i18n( "&Paste" ),
                                    this, SLOT(popupPaste()) ) );
  mEditOnlyItems.append( addAction( KOGlobals::self()->smallIcon( "edit-delete" ),
                                    i18nc( "delete this incidence", "&Delete" ),
                                    this, SLOT(popupDelete()) ) );
  //------------------------------------------------------------------------
  mEditOnlyItems.append( addSeparator() );
  mTodoOnlyItems.append( addAction( KOGlobals::self()->smallIcon( "task-complete" ),
                                    i18n( "Togg&le To-do Completed" ),
                                    this, SLOT(toggleTodoCompleted()) ) );
  mToggleReminder = addAction( QIcon( KOGlobals::self()->smallIcon( "appointment-reminder" ) ),
                                    i18n( "&Toggle Reminder" ), this, SLOT(toggleAlarm()));
  mEditOnlyItems.append( mToggleReminder );
  //------------------------------------------------------------------------
  mRecurrenceItems.append( addSeparator() );
  mDissociateOccurrences = addAction( i18n( "&Dissociate From Recurrence..." ),
                                      this, SLOT(dissociateOccurrences()) );
  mRecurrenceItems.append( mDissociateOccurrences );

  addSeparator();
  addAction( KOGlobals::self()->smallIcon( "mail-forward" ),
             i18n( "Send as iCalendar..." ),
             this, SLOT(forward()) );
}
Esempio n. 2
0
//The function responible for handling my finite state machine
void finiteStateMachine(int button){
	//May be a button debounce so exit the function
	if(doNotTriggerButton > 0)
		return;

	//The next bit contains the code monitoring the buttons
	//The buttons change their function depending on what mode the clock is
	//If the clock is running in normal mode
	if(state == RunNormal)
		switch(button){
			case 4  :
				switchTwelveHourMode();
			   break;
			case 5  :
				startModifyingTime(Alarm);
			   break;
			case 8  :
				//Stop the clock from operating
				startModifyingTime(Time);
				break;
			case 9  :
				toggleAlarm();
				break;
			case 11  :
				toggleMusic();
				break;
		}
	else if(state == SetupClocks)
		switch(button){
			case 4  :
				incrementModifyMinute(down);
				break;
			case 5  :
				incrementModifyMinute(up);
			   break;
			case 8  :
				incrementModifyHour(down);
				break;
			case 9  :
				incrementModifyHour(up);
				break;
			case 11  :
				finishModifyingTime();
				break;
		}
	else if(state == AlarmOn)
			switch(button){
				case 4  :
					switchTwelveHourMode();
					break;
				case 5  :
					enterSnoozeMode(10);
				   break;
				case 8  :
					enterSnoozeMode(15);
					break;
				case 9  :
					changeState(RunNormal);
					turnOffAlarm();
					break;
				case 11  :
					changeState(RunNormal);
					turnOffAlarm();
					break;
			}

	doNotTriggerButton = 50; //Set the debounce time
}