Bug 290050 - cannot add alarms after upgrading to 4.8 beta
Summary: cannot add alarms after upgrading to 4.8 beta
Alias: None
Product: kalarm
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: OpenSUSE Linux
: HI major (vote)
Target Milestone: ---
Assignee: David Jarvie
Depends on:
Reported: 2011-12-28 21:33 UTC by Silver Salonen
Modified: 2020-08-17 23:36 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:

KAlarm and Akonadi debug output (4.31 KB, application/octet-stream)
2012-01-13 20:13 UTC, Silver Salonen
KAlarm and Akonadi debug output no. 2 (4.76 KB, application/octet-stream)
2012-01-14 10:44 UTC, Silver Salonen

Note You need to log in before you can comment on or make changes to this bug.
Description Silver Salonen 2011-12-28 21:33:36 UTC
Version:           unspecified (using Devel) 
OS:                Linux

Buttons New, Edit, Copy, Delete are grayed out, so I guess KAlarm cannot talk to Akonadi or smth? I had one template too, and it's not listed under templates.

Reproducible: Always

Steps to Reproduce:
Start KAlarm

Actual Results:  
New, Edit, Copy, Delete are grayed out, cannot add or do quite anything.

Expected Results:  
Being able to add alarms
Comment 1 David Jarvie 2011-12-28 21:50:53 UTC
In the calendar view (menu View -> Show Calendars), are any calendars shown?

When you first run an Akonadi-based version of KAlarm (e.g. the KDE 4.8 version), it should automatically create Akonadi resources for you. If you used a previous non-Akonadi version of KAlarm, it should create Akonadi resources to access all your old calendars. If you haven't previously used KAlarm, it should have automatically created empty calendars and Akonadi resources.
Comment 2 Silver Salonen 2011-12-29 20:54:47 UTC
No, I cannot see any calendars, although I certainly have one. Any way to try the migration again?
Comment 3 David Jarvie 2011-12-30 00:53:45 UTC
A possible cause of the issue is that the Akonadi server may not be running when KAlarm attempts to create the Akonadi resources - I'm looking into how to ensure that this doesn't happen. Were there any error messages when you started KAlarm?
Comment 4 David Jarvie 2011-12-30 00:57:59 UTC
One way to try reinitialising is to quit KAlarm, then run akonadiconsole. In that application, do Server -> Start Server just to be sure that the Akonadi server is running. Then start KAlarm again, and hopefully it will initialise the calendars correctly. Let me know if this works.
Comment 5 Silver Salonen 2011-12-31 10:37:31 UTC
No, the migration won't start if I quit KAlarm and start it again.
Comment 6 David Jarvie 2011-12-31 18:49:32 UTC
1) I wonder whether the Akonadi server is running or even available at all. Can you please run the following command in a terminal window, and paste the output here:

    akonadictl status

2) Do any error messages appear when you start KAlarm?
Comment 7 Silver Salonen 2012-01-01 11:47:14 UTC
1) Yes, it's running. I see my events in events-list plasmoid.
$ akonadictl status
Akonadi Control: running
Akonadi Server: running
Akonadi Server Search Support: not available

2) No errors in UI.
$ kalarm
QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.
QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.
unnamed app(3519)/kalarm main: initialising
kalarm(3519) DBusHandler::DBusHandler:
kalarm(3519) KAlarmApp::KAlarmApp:
kalarm(3519)/kdecore (KConfigSkeleton) KCoreConfigSkeleton::writeConfig:
kalarm(3519) MinuteTimer::slotTimer:
kalarm(3519) KAlarmApp::KAlarmApp: Speech synthesis disabled (KTTSD not found)
kalarm(3519) KAlarmApp::newInstance:
kalarm(3519) CommandOptions::CommandOptions: Interactive
kalarm(3519) KAlarmApp::initCheck: first time
kalarm(3519) AlarmCalendar::open: "file:///home/silver/.kde4/share/apps/kalarm/displaying.ics"
kalarm(3519) AlarmCalendar::load: "file:///home/silver/.kde4/share/apps/kalarm/displaying.ics"
kalarm(3519) AlarmCalendar::load: --- Downloaded to "/home/silver/.kde4/share/apps/kalarm/displaying.ics"
kalarm(3519) AlarmCalendar::updateKAEvents: AlarmCalendar::updateKAEvents( "0" )
kalarm(3519) DailyTimer::start: at 0 : 0 : interval = 10 : 13 : 48
kalarm(3519) KAlarmApp::startProcessQueue:
kalarm(3519) MainWindow::MainWindow:
kalarm(3519) KAlarmApp::displayTrayIcon:
kalarm(3519) TrayWindow::TrayWindow:
kalarm(3519) TrayWindow::setEnabledStatus: 1
kalarm(3519) TrayWindow::tooltipAlarmText:
kalarm(3519) TrayWindow::slotHaveDisabledAlarms: false
kalarm(3519) TrayWindow::tooltipAlarmText:
kalarm(3519) KAlarmApp::processQueue:
kalarm(3519) KAlarm::purgeArchive: 7
Comment 8 David Jarvie 2012-01-03 00:24:41 UTC
Could you please check whether any Akonadi resources exist for KAlarm. Run akonadiconsole, and in its Agents tab, scroll down the list of agents to see whether there are any with the KAlarm icon. If you have always used the default KAlarm calendars, you should see three KAlarm agents, named "Active Alarms", "Archived Alarms" and "Alarm Templates".
Comment 9 Silver Salonen 2012-01-04 19:17:38 UTC
There's only one resource: Alarm Templates.

And actually I didn't have anything else but one template in KAlarm. But if I open templates from KAlarm now, there's nothing.
Comment 10 Roland Wolters 2012-01-05 15:28:45 UTC
I have the same problem - I cannot see any calendars in kalarm, all necessary buttons are greyed out.

I Akonadi console I tried to create a kalarm folder, and activated all ressources for it, but it is marked as "unable to start".
Comment 11 David Jarvie 2012-01-13 09:08:02 UTC
Silver, can you please try the following instructions to help find out what is going wrong.

1) Quit KAlarm and, using akonadiconsole, delete all KAlarm Akonadi resources.

2) Enable debug output for KAlarm and its Akonadi resources. To do this, run "kdebugdialog --fullmode" and select each of the following items, and set their output (debug, warning and error) to a temporary file:
   5950 kalarm
   5952 akonadiresource (kalarm)
   5954 akonadiserializer (kalarm)

3) After doing this, stop the Akonadi server (using "akonadictl stop"). Then restart Akonadi ("akonadictl start") and allow it to fully initialise.

4) Start KAlarm.

5) After KAlarm is up and running, attach the temporary file to this bug report.

6) To stop logging the debug output, run "kdebugdialog --fullmode" again and set the items back to their original settings.
Comment 12 Silver Salonen 2012-01-13 20:13:26 UTC
Created attachment 67792 [details]
KAlarm and Akonadi debug output
Comment 13 David Jarvie 2012-01-14 01:14:07 UTC
Thank you. The debug output shows 3 KAlarm Akonadi resources having been created successfully - for the active, archived and template calendars. Do you see these resources in KAlarm or akonadiconsole?

Unfortunately, there was no debug output in your attachment from KAlarm itself (only from the Akonadi resources). Perhaps KAlarm has been built without debug output enabled.
Comment 14 Silver Salonen 2012-01-14 10:44:06 UTC
Yes, now the resources existed and I could create alarms.

I did another test - I deleted all KAlarm's resources but Templates and now no new resources are created by KAlarm and I can't create new alarms again.

I exited KAlarm, deleted all resources and started KAlarm again - now all the resources are re-created again.

So I guess KAlarm should always check for all of its missing resources, not skip creating them if any of the 3 exists?

I'll attach the debug file again (now I set kalarm's debug output to the file also).
Comment 15 Silver Salonen 2012-01-14 10:44:31 UTC
Created attachment 67811 [details]
KAlarm and Akonadi debug output no. 2
Comment 16 David Jarvie 2012-01-14 14:29:30 UTC
KAlarm does provide options to create new resources without having to know about akonadiconsole etc. (use View -> Show Calendars and then use the Add button). I would think that if a user is aware enough of resources to delete some, he/she should be considered to be capable of creating new ones as well.

However, your original problem seems to have been that KAlarm created a templates resource, but not an active alarms resource - is this correct? If so, that would be a good argument for automatically creating resources on KAlarm startup if one or more resource types don't exist.
Comment 17 Silver Salonen 2012-01-14 14:56:00 UTC
Yes, this is exactly what I meant.

I just thought that KAlarm thought smth like:
  1) (upon migration) Let's check what alarms are there
  2) (upon migration) Oh there's one template, let's create an Akonadi resource for it
  3) (upon startup) Ah, there already is at least one Akonadi resources for KAlarm, no need to create more
  4) (upon startup) Oh, there's no standard resource for Akonadi, not able to create alarms

So the 3rd action is what should be changed :)

Anyway, you know better what KAlarm does and does not, so don't take my version too seriously now :)
Comment 18 David Jarvie 2012-01-14 15:40:25 UTC
In view of your experience, I think you're right that KAlarm should ensure that there is at least one resource of each type (active alarms, expired alarms and templates) when it starts up. If any type is missing, it should automatically create a resource for that type. This needs to be fixed as soon as possible.

Thank you for reporting this, and for your help in providing information and answering all my questions.
Comment 19 David Jarvie 2012-01-14 17:59:25 UTC
Roland, I don't think you are experiencing the same problem. If you want it investigated, please open a separate bug report. Also please follow the instructions in comment #11 and attach the debug output to the bug report.
Comment 20 David Jarvie 2012-01-16 00:38:24 UTC
Git commit 71f8625630094c14c9dce832bc9a6f9f8eca0d3f by David Jarvie.
Committed on 16/01/2012 at 01:33.
Pushed by djarvie into branch 'master'.

Bug 290050: Ensure that Akonadi resources exist for all alarm types

If no Akonadi resource exists for any alarm type (active, archived,
template) on KAlarm startup, create a default alarm calendar
resource. This ensures that if by error a calendar type is missing,
the user can still operate KAlarm without needing to manuallly
create calendars.

M  +5    -21   kalarm/akonadimodel.cpp
M  +118  -48   kalarm/calendarmigrator.cpp
M  +12   -1    kalarm/calendarmigrator.h

Comment 21 David Jarvie 2012-01-16 00:40:20 UTC
Git commit e8134ace1e449b061cc8b4f6a63e843a2709c15b by David Jarvie.
Committed on 16/01/2012 at 01:33.
Pushed by djarvie into branch 'KDE/4.8'.

Bug 290050: Ensure that Akonadi resources exist for all alarm types

If no Akonadi resource exists for any alarm type (active, archived,
template) on KAlarm startup, create a default alarm calendar
resource. This ensures that if by error a calendar type is missing,
the user can still operate KAlarm without needing to manuallly
create calendars.

M  +1    -1    kalarm/Changelog
M  +5    -21   kalarm/akonadimodel.cpp
M  +118  -48   kalarm/calendarmigrator.cpp
M  +12   -1    kalarm/calendarmigrator.h