187 iRgbColors = NULL; |
187 iRgbColors = NULL; |
188 } |
188 } |
189 |
189 |
190 iRgbColors = new(ELeave) CArrayFixFlat<TRgb>(2); |
190 iRgbColors = new(ELeave) CArrayFixFlat<TRgb>(2); |
191 |
191 |
192 iRgbColors->AppendL(KRgbRed); |
192 iRgbColors->AppendL(KCalenDarkBlue); |
193 iRgbColors->AppendL(KRgbDarkGray); |
193 iRgbColors->AppendL(KCalenDarkGreen); |
194 iRgbColors->AppendL(KRgbDarkRed); |
194 iRgbColors->AppendL(KCalenDarkRed); |
195 iRgbColors->AppendL(KRgbDarkGreen); |
195 iRgbColors->AppendL(KCalenMegenta); |
196 iRgbColors->AppendL(KRgbDarkYellow); |
196 iRgbColors->AppendL(KCalenBlue); |
197 iRgbColors->AppendL(KRgbDarkBlue); |
197 iRgbColors->AppendL(KCalenGreen); |
198 iRgbColors->AppendL(KRgbDarkMagenta); |
198 iRgbColors->AppendL(KCalenOrange); |
199 iRgbColors->AppendL(KRgbDarkCyan); |
199 iRgbColors->AppendL(KCalenlightMagenta); |
200 iRgbColors->AppendL(KRgbBlack); |
200 iRgbColors->AppendL(KCalenCyan); |
201 iRgbColors->AppendL(KRgbGreen); |
201 iRgbColors->AppendL(KCalenlightGreen); |
202 iRgbColors->AppendL(KRgbYellow); |
202 iRgbColors->AppendL(KCalenYellow); |
203 iRgbColors->AppendL(KRgbBlue); |
203 iRgbColors->AppendL(KCalenlightPink); |
204 iRgbColors->AppendL(KRgbMagenta); |
204 iRgbColors->AppendL(KCalenlightBlue); |
205 iRgbColors->AppendL(KRgbCyan); |
205 iRgbColors->AppendL(KCalenGold); |
206 iRgbColors->AppendL(KRgbGray); |
206 iRgbColors->AppendL(KCalenDarkOrange); |
207 iRgbColors->AppendL(KRgbWhite); |
207 iRgbColors->AppendL(KCalenPink); |
208 |
208 |
209 TRACE_EXIT_POINT |
209 TRACE_EXIT_POINT |
210 } |
210 } |
211 |
211 |
212 // ----------------------------------------------------------------------------- |
212 // ----------------------------------------------------------------------------- |
627 // --------------------------------------------------------------------------- |
635 // --------------------------------------------------------------------------- |
628 // |
636 // |
629 TBool CCalenMultiDBEditor::SaveNoteL( TInt aButtonId ) |
637 TBool CCalenMultiDBEditor::SaveNoteL( TInt aButtonId ) |
630 { |
638 { |
631 TRACE_ENTRY_POINT; |
639 TRACE_ENTRY_POINT; |
632 |
640 |
633 if( CheckSpaceBelowCriticalLevelL() ) |
641 if (CheckSpaceBelowCriticalLevelL()) |
634 { |
642 { |
635 TRACE_EXIT_POINT; |
643 TRACE_EXIT_POINT; |
636 return EFalse; |
644 return EFalse; |
637 } |
645 } |
638 |
646 |
639 if (Conflict() == CCalenMultiDBEditor::EConflictDelete) |
647 if (Conflict() == CCalenMultiDBEditor::EConflictDelete) |
640 { |
648 { |
641 CAknNoteDialog *note = new (ELeave) CAknNoteDialog( |
649 CAknNoteDialog *note = new (ELeave) CAknNoteDialog( |
642 CAknNoteDialog::EWarningTone, CAknNoteDialog::ENoTimeout); |
650 CAknNoteDialog::EWarningTone, CAknNoteDialog::ENoTimeout); |
643 HBufC* buf = StringLoader::LoadLC( R_QTN_CALENDAREDITOR_NOTE_DB_CONFLICT_DELETE, iEikonEnv); |
651 HBufC* buf = StringLoader::LoadLC( |
|
652 R_QTN_CALENDAREDITOR_NOTE_DB_CONFLICT_DELETE, iEikonEnv); |
644 note->SetTextL(*buf); |
653 note->SetTextL(*buf); |
645 note->ExecuteLD(R_CALEN_CALENDAREDITOR_CONFLICT_DIALOG); |
654 note->ExecuteLD(R_CALEN_CALENDAREDITOR_CONFLICT_DIALOG); |
646 CleanupStack::PopAndDestroy(buf); |
655 CleanupStack::PopAndDestroy(buf); |
647 return ETrue; |
656 return ETrue; |
648 } |
657 } |
649 else if (Conflict() == CCalenMultiDBEditor::EConflictUpdate) |
658 else if (Conflict() == CCalenMultiDBEditor::EConflictUpdate) |
650 { |
659 { |
651 CAknNoteDialog *note = new (ELeave) CAknNoteDialog( |
660 CAknNoteDialog *note = new (ELeave) CAknNoteDialog( |
652 CAknNoteDialog::EWarningTone, CAknNoteDialog::ENoTimeout); |
661 CAknNoteDialog::EWarningTone, CAknNoteDialog::ENoTimeout); |
653 HBufC* buf = StringLoader::LoadLC(R_QTN_CALENDAREDITOR_NOTE_DB_CONFLICT_UPDATE, iEikonEnv); |
662 HBufC* buf = StringLoader::LoadLC( |
|
663 R_QTN_CALENDAREDITOR_NOTE_DB_CONFLICT_UPDATE, iEikonEnv); |
654 note->SetTextL(*buf); |
664 note->SetTextL(*buf); |
655 note->ExecuteLD(R_CALEN_CALENDAREDITOR_CONFLICT_DIALOG); |
665 note->ExecuteLD(R_CALEN_CALENDAREDITOR_CONFLICT_DIALOG); |
656 CleanupStack::PopAndDestroy(buf); |
666 CleanupStack::PopAndDestroy(buf); |
657 return ETrue; |
667 return ETrue; |
658 } |
668 } |
663 TBool retValue = ETrue; |
673 TBool retValue = ETrue; |
664 RPointerArray<CCalCalendarInfo> calendarInfoList; |
674 RPointerArray<CCalCalendarInfo> calendarInfoList; |
665 iController.GetAllCalendarInfoL(calendarInfoList); |
675 iController.GetAllCalendarInfoL(calendarInfoList); |
666 CleanupClosePushL(calendarInfoList); |
676 CleanupClosePushL(calendarInfoList); |
667 const TBool continueOnError = ETrue; |
677 const TBool continueOnError = ETrue; |
668 ReadDataFromFormL( continueOnError); |
678 ReadDataFromFormL(continueOnError); |
669 |
679 |
670 iCalendarName->Des().Trim(); |
680 iCalendarName->Des().Trim(); |
671 // Check for the empty text |
681 // Check for the empty text |
672 if((!iCalendarName->Size()) ) |
682 if ((!iCalendarName->Size())) |
673 { |
683 { |
674 // If in editing mode, just save the name used before. |
684 // If in editing mode, just save the name used before. |
675 if( iEditFlag ) |
685 if (iEditFlag) |
676 { |
686 { |
677 iCalendarName->Des().Copy(iCalendarInfo.NameL()); |
687 iCalendarName->Des().Copy(iCalendarInfo.NameL()); |
678 SetEdwinTextL( ECalenMultiDbName, iCalendarName ); |
688 SetEdwinTextL(ECalenMultiDbName, iCalendarName); |
679 } |
689 } |
680 else |
690 else |
681 { |
691 { |
682 // else use the default name. |
692 // else use the default name. |
683 TInt index( KOne ); |
693 TInt index(KOne); |
684 HBufC* calendarName = StringLoader::LoadLC( R_CALE_DB_CALENDAR ); |
694 HBufC* calendarName = StringLoader::LoadLC(R_CALE_DB_CALENDAR); |
685 TBuf< KBuffLength > numBuf; |
695 TBuf<KBuffLength> numBuf; |
686 |
696 |
687 // Check if the name is already present. |
697 // Check if the name is already present. |
688 while( IsNameFoundL( *calendarName ) ) |
698 while (IsNameFoundL(*calendarName)) |
689 { |
699 { |
690 CleanupStack::PopAndDestroy( calendarName ); |
700 CleanupStack::PopAndDestroy(calendarName); |
691 numBuf.Zero(); |
701 numBuf.Zero(); |
692 if( index < KTen ) |
702 if (index < KTen) |
693 { |
703 { |
694 numBuf.Format( KFormatStringTwoDigit, index ); |
704 numBuf.Format(KFormatStringTwoDigit, index); |
695 } |
705 } |
696 else |
706 else |
697 { |
707 { |
698 numBuf.Format( KFormatString, index ); |
708 numBuf.Format(KFormatString, index); |
699 } |
709 } |
700 AknTextUtils::DisplayTextLanguageSpecificNumberConversion( |
710 AknTextUtils::DisplayTextLanguageSpecificNumberConversion( |
701 numBuf ); |
711 numBuf); |
702 calendarName = StringLoader::LoadLC( |
712 calendarName = StringLoader::LoadLC( |
703 R_CALE_DB_CALENDAR_DEFAULT_NAME, numBuf ); |
713 R_CALE_DB_CALENDAR_DEFAULT_NAME, numBuf); |
704 |
714 |
705 ++index; |
715 ++index; |
706 } |
716 } |
707 |
717 |
708 iCalendarName->Des().Append( calendarName->Des() ); |
718 iCalendarName->Des().Append(calendarName->Des()); |
709 |
719 |
710 CleanupStack::PopAndDestroy( calendarName ); |
720 CleanupStack::PopAndDestroy(calendarName); |
711 SetEdwinTextL( ECalenMultiDbName, iCalendarName ); |
721 SetEdwinTextL(ECalenMultiDbName, iCalendarName); |
712 } |
722 } |
713 |
723 |
714 } |
724 } |
715 |
725 |
716 // Check for the validity of the calendar name. |
726 // Check for the validity of the calendar name. |
717 if( IsNameValid( *iCalendarName ) ) |
727 if (IsNameValid(*iCalendarName)) |
718 { |
728 { |
719 // Name is valid. then check if it already exists or not. |
729 // Name is valid. then check if it already exists or not. |
720 if( IsNameEditedL( *iCalendarName ) ) |
730 if (IsNameEditedL(*iCalendarName)) |
721 { |
731 { |
722 TInt index = calendarInfoList.Find( *iCalendarName,CCalenMultiDBEditor::CalenInfoIdentifierL ); |
732 TInt index = calendarInfoList.Find(*iCalendarName, |
723 if(index != KErrNotFound) |
733 CCalenMultiDBEditor::CalenInfoIdentifierL); |
724 { |
734 if (index != KErrNotFound) |
725 retValue = EFalse; |
735 { |
726 if( EAknCmdExit != aButtonId ) |
736 retValue = EFalse; |
727 { |
737 if (EAknCmdExit != aButtonId) |
728 HBufC* infoText = StringLoader::LoadLC( |
738 { |
729 R_QTN_CALE_DB_ALREADY_EXISTS_NOTE , iCalendarName->Des() ); |
739 HBufC* infoText = StringLoader::LoadLC( |
730 CAknInformationNote* dialog = new( ELeave ) CAknInformationNote(ETrue); |
740 R_QTN_CALE_DB_ALREADY_EXISTS_NOTE, |
731 dialog->ExecuteLD( *infoText ); |
741 iCalendarName->Des()); |
732 CleanupStack::PopAndDestroy( infoText ); |
742 CAknInformationNote* dialog = |
733 } |
743 new (ELeave) CAknInformationNote(ETrue); |
734 } |
744 dialog->ExecuteLD(*infoText); |
735 else |
745 CleanupStack::PopAndDestroy(infoText); |
736 { |
746 } |
737 iCalendarInfo.SetNameL(*iCalendarName); |
747 } |
738 } |
748 else |
739 } |
749 { |
740 |
750 iCalendarInfo.SetNameL(*iCalendarName); |
741 } |
751 } |
742 else |
752 } |
743 { |
753 |
744 if( EAknCmdExit != aButtonId ) |
754 } |
745 { |
755 else |
746 retValue = EFalse; |
756 { |
747 HBufC* infoText(NULL); |
757 if (EAknCmdExit != aButtonId) |
748 infoText = AreIllegalChars( *iCalendarName ) ? StringLoader::LoadLC( R_CALEN_ILLEGAL_CHARACTERS ) : |
758 { |
749 StringLoader::LoadLC( R_CALEN_BAD_FILE_NAME ); |
759 retValue = EFalse; |
750 CAknInformationNote* dialog = new( ELeave ) CAknInformationNote(ETrue); |
760 HBufC* infoText(NULL); |
751 dialog->ExecuteLD( *infoText ); |
761 infoText |
752 CleanupStack::PopAndDestroy( infoText ); |
762 = AreIllegalChars(*iCalendarName) |
753 } |
763 ? StringLoader::LoadLC( |
754 } |
764 R_CALEN_ILLEGAL_CHARACTERS) |
755 |
765 : StringLoader::LoadLC( |
756 |
766 R_CALEN_BAD_FILE_NAME); |
757 if(IsColorEditedL( iColVal ) ) |
767 CAknInformationNote* dialog = new (ELeave) CAknInformationNote( |
758 { |
768 ETrue); |
759 iCalendarInfo.SetColor(iColVal); |
769 dialog->ExecuteLD(*infoText); |
760 } |
770 CleanupStack::PopAndDestroy(infoText); |
761 |
771 } |
762 |
772 } |
763 |
773 |
764 if( IsVisiblityFieldEditedL( iCalendarStatus ) ) |
774 if (IsColorEditedL(iColVal)) |
765 { |
775 { |
766 iCalendarInfo.SetEnabled(iCalendarStatus); |
776 iCalendarInfo.SetColor(iColVal); |
767 } |
777 } |
768 |
778 |
769 CleanupStack::PopAndDestroy(&calendarInfoList); |
779 if (IsVisiblityFieldEditedL(iCalendarStatus)) |
|
780 { |
|
781 iCalendarInfo.SetEnabled(iCalendarStatus); |
|
782 } |
|
783 |
|
784 CleanupStack::PopAndDestroy(&calendarInfoList); |
770 TRACE_EXIT_POINT; |
785 TRACE_EXIT_POINT; |
771 return retValue; |
786 return retValue; |
772 } |
787 } |
773 |
788 |
774 // --------------------------------------------------------------------------- |
789 // --------------------------------------------------------------------------- |
775 // CCalenMultiDBEditor::ExecuteLD |
790 // CCalenMultiDBEditor::ExecuteLD |
776 // Launches the MultiDB Form |
791 // Launches the MultiDB Form |
777 // --------------------------------------------------------------------------- |
792 // --------------------------------------------------------------------------- |