Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [KNotification] method sendEvent() is not called.
Forum Updated to NodeBB v4.3 + New Features

[KNotification] method sendEvent() is not called.

Scheduled Pinned Locked Moved General and Desktop
25 Posts 3 Posters 9.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Tupla
    wrote on last edited by
    #13

    For everything to work you have to use KApplication, not QApplication (because the "appname" is given in main using KAboutData class).
    Example of main:
    @KAboutData about("appname", 0, ki18n("MyApp"), "1.0" /* version /, / for other parameters see KAboutData docs */);
    KCmdLineArgs::init(argc, argv, &about);
    KApplication app;

    MyMainWidget *widget = new MyMainWidget;
    widget->show();

    return app.exec();@
    Obviously, MyMainWidget is your main window class, code it as you like.
    If you create a "appname.notifyrc" file, write into it your events and install it with that CMake command, when you send an event in your code, a notification should be displayed.
    I didn't understand why you set your file as root, that command only installs it in your installation prefix.

    However, kill knotify4 (CTRL+Esc, search for knotify4 and kill it), then from a terminal run kbuildsycoca4.
    If it doesn't work again, try to copy appname.notifyrc in your main KDE prefix (should be /use/share/kde4/apps if you use kubuntu, for example) by creating a new directory named "appname", place your file in there. With this extreme way it has to work when you kill knotify4 and run kbuildsycoca4.

    1 Reply Last reply
    0
    • R Offline
      R Offline
      Ruu_Rinki
      wrote on last edited by
      #14

      It worked, thanks.
      Only now I do not understand how it works:)
      If I write the line:
      @
      KAboutData about ("notify", 0, ki18n ("notify"), "1.0");
      @
      It works, despite the fact that my file - it's psnotify.notifyrc
      However, if I write the line:
      @
      KAboutData about ("psnotify", 0, ki18n ("psnotify"), "1.0");
      @
      It does not cause notice.

      I have to you one more question - where information can be read from the config?
      And where information can be read, if I deleted all the config files from the system? (Where a thread can sit in the cache)?

      1 Reply Last reply
      0
      • T Offline
        T Offline
        Tupla
        wrote on last edited by
        #15

        Mmm, I don't know, since I tried using the same name for application name in KAboutData and in the name of the notification file.

        Sorry, but I don't understand your question. Maybe you want to know where configuration files for your KDE application are stored and how to access to configuration data?

        1 Reply Last reply
        0
        • R Offline
          R Offline
          Ruu_Rinki
          wrote on last edited by
          #16

          Yes, exactly :-)
          I use Mandriva Linux 2010 and i know that configuration files are in the /usr/local/share/apps/appname/appname.notifyrc
          and
          /usr/share/apps/appname/appname.notifyrc
          Could it be that they are stored in another location?

          1 Reply Last reply
          0
          • T Offline
            T Offline
            Tupla
            wrote on last edited by
            #17

            If you compile KDE from source, you should be able to specify the "prefix" where to install it, most commons are /usr/local, /usr/, or somewhere in your home directory if you don't want to have it system-wide (especially with KDE unstable branch).
            In /usr/local, which is your prefix, there are main configuration files. They contain the basic options and configuration for each application. When you first start a KDE application, configuration files are copied from your prefix into your home directory, so that you can customize them without touching the original files in /usr/local (also because you normal user don't have enough permissions). You home directory should be $HOME/.kde or $HOME/.kde4. The next time you start the same application, configuration are read both from your own config file in .kde or .kde4, and merged with other option in the "global" configuration file (in /usr/local).

            To access data in a configuration file (I'm talking about config file of your application, which you implemented) you have to use KConfig, KConfigGroup and other classes in your application. Also, you don't need to specify where to put your configuration file, KDE will create it in your home directory (again, .kde or .kde4), simply create a KConfig or KConfigGroup object, and read or write entry into your config file.

            1 Reply Last reply
            0
            • R Offline
              R Offline
              Ruu_Rinki
              wrote on last edited by
              #18

              I did "logout" and when logged again, I discovered that notification not show.
              How can it be?

              1 Reply Last reply
              0
              • T Offline
                T Offline
                Tupla
                wrote on last edited by
                #19

                Where did you put your notifyrc file? Does it match the name of your application?

                1 Reply Last reply
                0
                • R Offline
                  R Offline
                  Ruu_Rinki
                  wrote on last edited by
                  #20

                  Thanks, it works, I understood.
                  I want ask you, I have a small question: May I put default action in notify, if it had to disappeared and nobody choosing action?

                  1 Reply Last reply
                  0
                  • T Offline
                    T Offline
                    Tupla
                    wrote on last edited by
                    #21

                    Do you mean if the notification timeout expires and it disappears without having time to choose an action? You find it in "recent notification", next to the system tray. Or you can use Persistent flag, and close it manually when your code has been executed.

                    1 Reply Last reply
                    0
                    • R Offline
                      R Offline
                      Ruu_Rinki
                      wrote on last edited by
                      #22

                      Yes-yes, you are right. But I was wondering whether the disappearance of notification perform the action by default, if you have not chosen any action.

                      1 Reply Last reply
                      0
                      • T Offline
                        T Offline
                        Tupla
                        wrote on last edited by
                        #23

                        Nope, I think the disappearance doesn't perform any action by default, you have to manually activate it.

                        1 Reply Last reply
                        0
                        • R Offline
                          R Offline
                          Ruu_Rinki
                          wrote on last edited by
                          #24

                          Thanks, Tupla ^___^

                          1 Reply Last reply
                          0
                          • T Offline
                            T Offline
                            Tupla
                            wrote on last edited by
                            #25

                            You're welcome!

                            1 Reply Last reply
                            0

                            • Login

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • Users
                            • Groups
                            • Search
                            • Get Qt Extensions
                            • Unsolved