Bug 450299 - QCommandLineParser: option not defined: "create"
Summary: QCommandLineParser: option not defined: "create"
Status: REPORTED
Alias: None
Product: konsolekalendar
Classification: Applications
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Allen Winter
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-02-15 12:31 UTC by felician.nemeth
Modified: 2024-08-25 09:36 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description felician.nemeth 2022-02-15 12:31:36 UTC
SUMMARY

This is with "konsolekalendar 5.15.3", but I'm not able to select that in the bug-reporting form.  I'm not even sure this is the right bugtracker to report the issue.

If I start konsolekalendar in any meaningful way I get a warning (error?) message saying: QCommandLineParser: option not defined: "create".

Looking at the source it seems to following patch fixes the problem:
--- main.cpp~   2020-10-10 21:57:59.000000000 +0200
+++ main.cpp    2022-02-13 08:59:41.717446351 +0100
@@ -101,7 +101,7 @@
     parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("add"), i18n("Insert an incidence into the calendar")));
     parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("change"), i18n("Modify an existing incidence")));
     parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("delete"), i18n("Remove an existing incidence")));
-    parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("create <filename>"), i18n("Create new Akonadi Resource for file")));
+    parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("create"), i18n("Create new Akonadi Resource for file"), QStringLiteral("[filename]")));
     parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("import"), i18n("Import this calendar to main calendar"),  QStringLiteral("[import-file]")));
     parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("list-calendars"), i18n("List available calendars")));
     parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("all"), i18n("View all calendar entries, ignoring date/time options")));



STEPS TO REPRODUCE
1.  start: konsolekalendar --next
2. 
3. 

OBSERVED RESULT
QCommandLineParser: option not defined: "create"
kf.calendarcore: The incidence didn't have any UID! Report a bug  to the application that generated this file.
kf.calendarcore: The incidence didn't have any UID! Report a bug  to the application that generated this file.
kf.calendarcore: The incidence didn't have any UID! Report a bug  to the application that generated this file.
kf.calendarcore: The incidence didn't have any UID! Report a bug  to the application that generated this file.
Incidence has empty UID. id= 6 ; summary= "asdf" Please fix it. Ignoring this incidence.
Incidence has empty UID. id= 5 ; summary= "asdf" Please fix it. Ignoring this incidence.
Incidence has empty UID. id= 4 ; summary= "asdf" Please fix it. Ignoring this incidence.
Incidence has empty UID. id= 3 ; summary= "asdf" Please fix it. Ignoring this incidence.

EXPECTED RESULT
kf.calendarcore: The incidence didn't have any UID! Report a bug  to the application that generated this file.
kf.calendarcore: The incidence didn't have any UID! Report a bug  to the application that generated this file.
kf.calendarcore: The incidence didn't have any UID! Report a bug  to the application that generated this file.
kf.calendarcore: The incidence didn't have any UID! Report a bug  to the application that generated this file.
Incidence has empty UID. id= 6 ; summary= "asdf" Please fix it. Ignoring this incidence.
Incidence has empty UID. id= 5 ; summary= "asdf" Please fix it. Ignoring this incidence.
Incidence has empty UID. id= 4 ; summary= "asdf" Please fix it. Ignoring this incidence.
Incidence has empty UID. id= 3 ; summary= "asdf" Please fix it. Ignoring this incidence.

(Well, It would be better if konsolekalendar would work with empty UID-s, but that's a different issue.)

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 5.20.5
KDE Frameworks Version: 5.78.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
If the version control system is at https://invent.kde.org, then the bug is present in the latest version as well: https://invent.kde.org/pim/akonadi-calendar-tools/-/blob/master/konsolekalendar/main.cpp#L83
Comment 1 Robert Spillner 2024-08-25 09:36:27 UTC
Probably better to have the filename as a required parameter. Still, this bug is trivial and should be fixed.

diff --git a/konsolekalendar/main.cpp b/konsolekalendar/main.cpp
index ef17719..f47eea2 100644
--- a/konsolekalendar/main.cpp
+++ b/konsolekalendar/main.cpp
@@ -80,7 +80,7 @@ int main(int argc, char *argv[])
     parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("add"), i18n("Insert an incidence into the calendar")));
     parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("change"), i18n("Modify an existing incidence")));
     parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("delete"), i18n("Remove an existing incidence")));
-    parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("create <filename>"), i18n("Create new Akonadi Resource for file")));
+    parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("create"), i18n("Create new Akonadi Resource for file"), QStringLiteral("filename")));
     parser.addOption(
         QCommandLineOption(QStringList() << QStringLiteral("import"), i18n("Import this calendar to main calendar"), QStringLiteral("[import-file]")));
     parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("list-calendars"), i18n("List available calendars")));