summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt3
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt4
-rw-r--r--korganizer/calendarview.cpp17
-rw-r--r--korganizer/kofilterview.cpp32
-rw-r--r--korganizer/kofilterview.h3
-rw-r--r--korganizer/koprefs.cpp4
-rw-r--r--korganizer/main.cpp1
-rw-r--r--korganizer/mainwindow.cpp9
8 files changed, 60 insertions, 13 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index dfc9553..2e120df 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,8 +1,11 @@
Info about the changes in new versions of KDE-Pim/Pi
********** VERSION 2.1.10 ************
+KO/Pi:
+Importing Birthdays will now create another file resource "Birthdays" and import the birthday data from KA/Pi into that file.
+
********** VERSION 2.1.9 ************
KO/Pi:
Fixed some problems of the new search options in the search dialog.
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt
index 2ade5bd..01c707e 100644
--- a/bin/kdepim/korganizer/germantranslation.txt
+++ b/bin/kdepim/korganizer/germantranslation.txt
@@ -1454,10 +1454,10 @@
{ "Backup globally disabled","Backup global abgeschaltet" },
{ "Backup succesfully finished","Backup erfolgreich beendet" },
{ "(Hint: You can enable automatic backup in the global settings!)","(Hinweis: Sie können ein automatisches Backup in den globalen Einstellungen konfigurieren!)" },
{ "This will <b>backup all calendar files</b> to the directory %1 %2","Das schreibt ein <b>Backup aller Kalenderdateien</b> in das Verzeichnis %1 %2" },
-{ "","" },
-{ "","" },
+{ "Birthdays","Geburtstage" },
+{ "KO/Pi import information!","KO/Pi Import Information!" },
{ "","" },
{ "","" },
{ "","" },
{ "","" },
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 08909ed..f179c58 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1606,8 +1606,13 @@ bool CalendarView::importBday()
{
#ifndef KORG_NOKABC
#ifdef DESKTOP_VERSION
+ int curCal = mCalendar->defaultCalendar();
+ int bd = mCalEditView->getBirtdayID();
+ if ( bd == 0 )
+ return;
+ mCalendar->setDefaultCalendar( bd );
KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
KABC::AddressBook::Iterator it;
int count = 0;
for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
@@ -1644,8 +1649,9 @@ bool CalendarView::importBday()
if ( addAnniversary( anni, (*it).assembledName(), a, false ) )
++addCount;
}
}
+ mCalendar->setDefaultCalendar( curCal );
updateView();
topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!"));
#else //DESKTOP_VERSION
@@ -1665,11 +1671,19 @@ void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthd
const QStringList& anniversaryList, const QStringList& realNameList,
const QStringList& emailList, const QStringList& assembledNameList,
const QStringList& uidList)
{
+
//qDebug("KO::CalendarView::insertBirthdays");
if (uid == this->name())
- {
+ {
+ int curCal = mCalendar->defaultCalendar();
+ int bd = mCalEditView->getBirtdayID();
+ if ( bd == 0 )
+ return;
+ mCalendar->setDefaultCalendar( bd );
+
+
int count = birthdayList.count();
int addCount = 0;
KCal::Attendee* a = 0;
@@ -1730,8 +1744,9 @@ void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthd
++addCount;
}
}
+ mCalendar->setDefaultCalendar( curCal );
updateView();
topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!"));
}
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp
index a8a3052..3cde103 100644
--- a/korganizer/kofilterview.cpp
+++ b/korganizer/kofilterview.cpp
@@ -353,9 +353,9 @@ void KOCalEditView::addCal()
bool tryagain = true;
QString name, file;
while ( tryagain ) {
KONewCalPrefs prefs ( this );
- prefs.nameE->setText( name );
+ prefs.nameE->setText( name );
prefs.url->setURL( file );
if ( ! prefs.exec() )
return;
name = prefs.calName();
@@ -377,16 +377,22 @@ void KOCalEditView::addCal()
}
kkf = KOPrefs::instance()->mCalendars.next();
}
}
+ addCalendar ( name, file );
+}
+int KOCalEditView::addCalendar( QString name, QString file, bool ask )
+{
+
QFileInfo fi ( file );
if (!fi.exists() ) {
- if ( KMessageBox::questionYesNo(this, i18n("The file\n%1\ndoes not exist!\nShall I create it for you?").arg( file ) )== KMessageBox::No )
- return;
+ if ( ask )
+ if ( KMessageBox::questionYesNo(this, i18n("The file\n%1\ndoes not exist!\nShall I create it for you?").arg( file ) )== KMessageBox::No )
+ return 0;
QFile fileIn( file );
if (!fileIn.open( IO_WriteOnly ) ) {
KMessageBox::sorry( this, i18n("Sorry, cannot create the file\n%1!\nNo calendar added!").arg( file ) );
- return;
+ return 0;
}
QTextStream tsIn( &fileIn );
tsIn.setCodec( QTextCodec::codecForName("utf8") );
tsIn << "BEGIN:VCALENDAR\nPRODID:-//KDE-Pim//Platform-independent 2.1.0\nVERSION:2.0\nEND:VCALENDAR\n";
@@ -395,11 +401,25 @@ void KOCalEditView::addCal()
KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar();
kkf->mName = name;
kkf->mFileName = file;
emit calendarAdded( kkf->mCalNumber );
- emit needsUpdate();
- QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
+ if ( ask )
+ emit needsUpdate();
+ QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
+ return kkf->mCalNumber;
}
+int KOCalEditView::getBirtdayID()
+{
+ KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
+ while ( kkf ) {
+ if ( kkf->mName == i18n("Birthdays") )
+ return kkf->mCalNumber;
+ kkf = KOPrefs::instance()->mCalendars.next();
+ }
+ QString file = locateLocal( "data", "korganizer/birthdays.ics" );
+ return addCalendar( i18n("Birthdays"), file, false );
+}
+
void KOCalEditView::enableAll()
{
toggleList( mEnabledB );
}
diff --git a/korganizer/kofilterview.h b/korganizer/kofilterview.h
index b57a6e9..54fe2c5 100644
--- a/korganizer/kofilterview.h
+++ b/korganizer/kofilterview.h
@@ -207,9 +207,10 @@ class KOCalEditView : public QScrollView
Q_OBJECT
public:
KOCalEditView( QWidget* parent=0,const char* name=0);
~KOCalEditView();
-
+ int addCalendar( QString calName, QString fileName, bool ask = true );
+ int getBirtdayID();
public slots:
void addCal();
void enableAll();
void enableAlarm();
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index a4ea3d3..7ba7269 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -459,8 +459,12 @@ void KOPrefs::usrReadConfig()
kkf->mDefaultColor = fc.readColorEntry( prefix+"_Color",&mEventColor);
if ( kkf->mCalNumber == 1 ) {
kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" );
}
+ //qDebug("NAME %s %s", kkf->mName.latin1(), i18n("Birthdays").latin1() );
+ if ( kkf->mName == i18n("Birthdays") ) {
+ kkf->mFileName = locateLocal( "data", "korganizer/birthdays.ics" );
+ }
}
KPimPrefs::usrReadConfig();
}
diff --git a/korganizer/main.cpp b/korganizer/main.cpp
index 2bf46b9..c9d1345 100644
--- a/korganizer/main.cpp
+++ b/korganizer/main.cpp
@@ -84,8 +84,9 @@ int main( int argc, char **argv )
#endif
KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer")));
QApplication::setFont( KPimGlobalPrefs::instance()->mApplicationFont );
+ KPimGlobalPrefs::instance()->setGlobalConfig();
MainWindow m;
#ifndef DESKTOP_VERSION
QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& )));
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index b9d8742..68233e8 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -172,9 +172,9 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
mBlockAtStartup = true;
mFlagKeyPressed = false;
setCaption("KO/Pi");
KOPrefs *p = KOPrefs::instance();
- KPimGlobalPrefs::instance()->setGlobalConfig();
+ //KPimGlobalPrefs::instance()->setGlobalConfig();
p->mCurrentDisplayedView = 0;
if ( p->mHourSize > 22 )
p->mHourSize = 22;
QMainWindow::ToolBarDock tbd;
@@ -1722,9 +1722,9 @@ void MainWindow::importOL()
#endif
}
void MainWindow::importBday()
{
- int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
+ int result = QMessageBox::warning( this, i18n("KO/Pi import information!"),
i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
i18n("Import!"), i18n("Cancel"), 0,
0, 1 );
if ( result == 0 ) {
@@ -2309,17 +2309,20 @@ void MainWindow::configureAgenda( int item )
}
void MainWindow::saveCalendar()
{
-
QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir;
if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir)
bupDir = KGlobalSettings::backupDataDir();
bupDir = KGlobal::formatMessage ( bupDir, 0 );
QString bupHint;
if ( !KPimGlobalPrefs::instance()->mBackupEnabled )
bupHint = i18n("(Hint: You can enable automatic backup in the global settings!)");
if ( KMessageBox::warningContinueCancel( this, i18n("This will <b>backup all calendar files</b> to the directory %1 %2").arg(bupDir).arg(bupHint),i18n("Information") ) != KMessageBox::Continue ) return;
+ bool enabled = KPimGlobalPrefs::instance()->mBackupEnabled;
+ KPimGlobalPrefs::instance()->mBackupEnabled = false;
+ save();
+ KPimGlobalPrefs::instance()->mBackupEnabled = enabled;
backupAllFiles();
}
void MainWindow::loadCalendar()
{