This commit is contained in:
Patrick von Reth 2014-01-20 14:32:42 +01:00
parent 1b223fbb82
commit 3921933f72
3 changed files with 92 additions and 4 deletions

View File

@ -29,30 +29,82 @@ namespace Snore{
class ApplicationData; class ApplicationData;
/**
* Application contains all relevant data to manage applications with the notification backend.
* Application uses a shared datamodel, its content is never copied and automatically released.
*
* @author Patrick von Reth \<vonreth at kde.org\>
*/
class SNORE_EXPORT Application class SNORE_EXPORT Application
{ {
public: public:
Application(); Application();
/**
* Creates a new Application object
* @param name
* @param icon
* @see SnoreCore::registerApplication
*/
explicit Application ( const QString &name, const Icon &icon); explicit Application ( const QString &name, const Icon &icon);
/**
* The copy constructor
* @param other
*/
Application(const Application &other); Application(const Application &other);
/**
* The copy operator
* @param other
*/
Application &operator=(const Application &other); Application &operator=(const Application &other);
~Application(); ~Application();
/**
* Add an alert to the Application
* @param alert the Alert
*/
void addAlert(const Alert &alert); void addAlert(const Alert &alert);
/**
*
* @return the name of the Application
*/
QString name() const; QString name() const;
/**
*
* @return the default icon for Notifications ans Alerts of this Application.
*/
const Icon &icon() const; const Icon &icon() const;
/**
* Returns a QHash with the Alers registered with this Application
*/
const QHash<QString,Alert> &alerts() const; const QHash<QString,Alert> &alerts() const;
/**
*
* @return whether the Application is valid
*/
bool isValid() const; bool isValid() const;
/** /**
* Application specific hints: * Returns application specific hints:
* <table> * <table>
* <tr><td>desktop-entry</td><td>The name of the desktop enty associated with the application</td><td>Used for The freedesktop backend</td></tr> * <tr><td>desktop-entry</td><td>The name of the desktop enty associated with the application</td><td>Used for The freedesktop backend</td></tr>
* <tr><td>windows-app-id</td><td>The app id associated with the application</td><td>Needed for the Windows 8 backend <a href="http://msdn.microsoft.com/en-us/library/windows/apps/dd378459.aspx">See MSDN</a></td></tr> * <tr><td>windows-app-id</td><td>The app id associated with the application</td><td>Needed for the Windows 8 backend <a href="http://msdn.microsoft.com/en-us/library/windows/apps/dd378459.aspx">See MSDN</a></td></tr>
* </table> * </table>
* @return the hints
*/ */
Hint &hints(); Hint &hints();
/**
* Same as hints
* @see hints
*/
const Hint &constHints() const; const Hint &constHints() const;
private: private:
QExplicitlySharedDataPointer<ApplicationData> d; QExplicitlySharedDataPointer<ApplicationData> d;

View File

@ -35,7 +35,7 @@ SNORE_EXPORT QDebug operator<< ( QDebug, const Snore::Hint &);
namespace Snore namespace Snore
{ {
/** /**
* Hint contains extra information for Notifications and Applications * Hint contains extra information accesible by key
*/ */
class SNORE_EXPORT Hint class SNORE_EXPORT Hint
@ -43,12 +43,49 @@ class SNORE_EXPORT Hint
public: public:
Hint(); Hint();
/**
* Sets the value for the key
* @param key the key
* @param value the value
*/
void setValue(const QString &key, const QVariant &value); void setValue(const QString &key, const QVariant &value);
/**
* The associated value of the key if present, returns the default value otherwise.
* @param key the key
* @param defaultValue the fallback value
*/
QVariant value(const QString & key, const QVariant & defaultValue = QVariant() ) const; QVariant value(const QString & key, const QVariant & defaultValue = QVariant() ) const;
/**
*
* @param key the key
* @return whether the key is set
*/
bool contains ( const QString & key ) const; bool contains ( const QString & key ) const;
/**
* Sets the value for the key depending on the owner
* @param owner the owner
* @param key the key
* @param value the value
*/
void setPrivateValue(const void *owner, const QString &key, const QVariant &value); void setPrivateValue(const void *owner, const QString &key, const QVariant &value);
/**
* The associated value of the key if present, returns the default value otherwise.
* @param owner the owner
* @param key the key
* @param defaultValue the fallback value
*/
QVariant privateValue(const void *owner, const QString & key, const QVariant & defaultValue = QVariant() ) const; QVariant privateValue(const void *owner, const QString & key, const QVariant & defaultValue = QVariant() ) const;
/**
*
* @param owner the owner
* @param key the key
* @return whether the key is set
*/
bool containsPrivateValue(const void *owner, const QString & key ) const; bool containsPrivateValue(const void *owner, const QString & key ) const;
private: private:

View File

@ -79,7 +79,6 @@ public:
/** /**
* The copy operator * The copy operator
* @param other * @param other
* @return
*/ */
Notification &operator=(const Notification &other); Notification &operator=(const Notification &other);
~Notification(); ~Notification();