home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / KNotesAppIface.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-07-22  |  7.2 KB  |  216 lines

  1. /*******************************************************************
  2.  KNotesIface.h  --  This file defines the DCOP interface for KNotes.
  3.  
  4.  Copyright (C) 2004 by Michael Brade <brade@kde.org>
  5.  
  6.  This program is free software; you can redistribute it and/or
  7.  modify it under the terms of the GNU General Public License
  8.  as published by the Free Software Foundation; either version 2
  9.  of the License, or (at your option) any later version.
  10.  
  11.  This program is distributed in the hope that it will be useful,
  12.  but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  GNU General Public License for more details.
  15.  
  16.  You should have received a copy of the GNU General Public License
  17.  along with this program; if not, write to the Free Software
  18.  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  19.  
  20.  In addition, as a special exception, the copyright holders give
  21.  permission to link the code of this program with any edition of
  22.  the Qt library by Trolltech AS, Norway (or with modified versions
  23.  of Qt that use the same license as Qt), and distribute linked
  24.  combinations including the two.  You must obey the GNU General
  25.  Public License in all respects for all of the code used other than
  26.  Qt.  If you modify this file, you may extend this exception to
  27.  your version of the file, but you are not obligated to do so.  If
  28.  you do not wish to do so, delete this exception statement from
  29.  your version.
  30. *******************************************************************/
  31.  
  32. #ifndef __KNotesAppIface_h__
  33. #define __KNotesAppIface_h__
  34.  
  35. #include <qstring.h>
  36. #include <qmap.h>
  37.  
  38. #include <dcopobject.h>
  39.  
  40.  
  41. class KNotesAppIface : virtual public DCOPObject
  42. {
  43.     K_DCOP
  44. k_dcop:
  45.     /**
  46.      * Create a new note.
  47.      * @param name the name (title) of the new note, if it is empty,
  48.      *        KNotes will choose an appropriate name
  49.      * @param text the body of the new note
  50.      * @return the new notes' id
  51.      */
  52.     virtual QString newNote( const QString& name = QString::null,
  53.                              const QString& text = QString::null ) = 0;
  54.  
  55.     /**
  56.      * Create a new note and inserts the current text in the clipboard
  57.      * as text.
  58.      *
  59.      * @param name the name (title) of the new note, if it is empty,
  60.      *        KNotes will choose an appropriate name
  61.      * @return the new notes' id
  62.      */
  63.     virtual QString newNoteFromClipboard( const QString& name = QString::null ) = 0;
  64.  
  65.     /**
  66.      * Deletes a note forever.
  67.      * @param noteId the id of the note to kill
  68.      */
  69.     virtual ASYNC killNote( const QString& noteId ) = 0;
  70.  
  71.     /**
  72.      * Deletes a note forever.
  73.      * @param noteId the id of the note to kill
  74.      * @param force do not request confirmation
  75.      */
  76.     virtual ASYNC killNote( const QString& noteId, bool force ) = 0;
  77.  
  78.     /**
  79.      * Get all the notes including their ids.
  80.      * @return a QMap that maps the id of a note to its name
  81.      */
  82.     virtual QMap<QString,QString> notes() const = 0;
  83.  
  84.     /**
  85.      * Changes the title/name of a note.
  86.      * @param noteId the id of the note to be modified
  87.      * @param newName the new title
  88.      */
  89.     virtual ASYNC setName( const QString& noteId, const QString& newName ) = 0;
  90.  
  91.     /**
  92.      * Sets the text of a note. This will delete the old text!
  93.      * @param noteId the id of the note
  94.      * @param newText the new text for the note
  95.      */
  96.     virtual ASYNC setText( const QString& noteId, const QString& newText ) = 0;
  97.  
  98.     /**
  99.      * Returns the foreground/text color of a note.
  100.      * @param noteId the id of the note in question
  101.      * @return the foreground/text color as a QString
  102.      */
  103.     virtual QString fgColor( const QString& noteId ) const = 0;
  104.  
  105.     /**
  106.      * Returns the background color of a note.
  107.      * @param noteId the id of the note in question
  108.      * @return the background color as a QString
  109.      */
  110.     virtual QString bgColor( const QString& noteId ) const = 0;
  111.  
  112.     /**
  113.      * Sets the color (foreground and background color) of a note.
  114.      * @param noteId the id of the note
  115.      * @param fgColor the new text color for the note
  116.      * @param bgColor the new background color for the note
  117.      */
  118.     virtual ASYNC setColor( const QString& noteId, const QString& fgColor,
  119.                                                    const QString& bgColor ) = 0;
  120.  
  121.     /**
  122.      * Returns the title/name of a note.
  123.      * @param noteId the id of the note in question
  124.      * @return the name as a QString
  125.      */
  126.     virtual QString name( const QString& noteId ) const = 0;
  127.  
  128.     /**
  129.      * Returns the text of a note.
  130.      * @param noteId the id of the note in question
  131.      * @return the body as a QString
  132.      */
  133.     virtual QString text( const QString& noteId ) const = 0;
  134.  
  135.  
  136.     /******** HERE STARTS THE KNotesAppIface DCOP INTERFACE EXTENSION ********/
  137.  
  138.     /**
  139.      * Show a note as if it had been selected from the "notes" menu.
  140.      * @param noteId the id of the note to show
  141.      */
  142.     virtual ASYNC showNote( const QString& noteId ) const = 0;
  143.  
  144.     /**
  145.      * Hide a note.
  146.      * @param noteId the id of the note to hide
  147.      */
  148.     virtual ASYNC hideNote( const QString& noteId ) const = 0;
  149.  
  150.     /**
  151.      * Show all notes on their respective desktops.
  152.      */
  153.     virtual ASYNC showAllNotes() const = 0;
  154.  
  155.     /**
  156.      * Hide all notes.
  157.      */
  158.     virtual ASYNC hideAllNotes() const = 0;
  159.  
  160.     /**
  161.      * Returns the width of a note.
  162.      * @param noteId the id of the note in question
  163.      * @return the width as a uint
  164.      */
  165.     virtual int width( const QString& noteId ) const = 0;
  166.  
  167.     /**
  168.      * Returns the height of a note.
  169.      * @param noteId the id of the note in question
  170.      * @return the height as a uint
  171.      */
  172.     virtual int height( const QString& noteId ) const = 0;
  173.  
  174.     /**
  175.      * Repositions a note.
  176.      * @param noteId the id of the note to be moved
  177.      * @param x the new x-coordinate of the note
  178.      * @param y the new y-coordinate of the note
  179.      */
  180.     virtual ASYNC move( const QString& noteId, int x, int y ) const = 0;
  181.  
  182.     /**
  183.      * Changes the size of a note.
  184.      * @param noteId the id of the note to be resized
  185.      * @param width the new width of the note
  186.      * @param height the new height of the note
  187.      */
  188.     virtual ASYNC resize( const QString& noteId, int width, int height ) const = 0;
  189.  
  190.     /**
  191.      * This tells KNotes that a specific app has synchronized with all the notes.
  192.      * @param app the app that has synced with KNotes
  193.      */
  194.     virtual ASYNC sync( const QString& app ) = 0;
  195.  
  196.     /**
  197.      * Test if a note was created new after the last sync.
  198.      * @param app the app that wants to get the status since the last sync
  199.      * @param noteId the id of the note
  200.      * @return true if the note is new, false if not or if the note does
  201.      *         not exist
  202.      */
  203.     virtual bool isNew( const QString& app, const QString& noteId ) const = 0;
  204.  
  205.     /**
  206.      * Test if a note was modified since the last sync.
  207.      * @param app the app that wants to get the status since the last sync
  208.      * @param noteId the id of the note
  209.      * @return true if modified (note that this will return true if the note is
  210.      *         new as well!) and false if the note is not modified or doesn't exist
  211.      */
  212.     virtual bool isModified( const QString& app, const QString& noteId ) const = 0;
  213. };
  214.  
  215. #endif
  216.