[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    [PATCH] KNotes: geometry DCOP functions, DCOP newlines question
From:       Michael Brade <brade () kde ! org>
Date:       2006-07-05 19:11:50
Message-ID: 200607052111.57507.brade () kde ! org
[Download RAW message or body]

[Attachment #2 (multipart/mixed)]


Hi,

here's another trivial patch to add 4 new DCOP methods I have been asked 
repeatedly to support: height(), width(), move(), and resize(). Cornelius? :)

And I have another problem: is it possible to add newline characters with DCOP 
somehow? This
  dcop knotes KNotesIface newNote "title" "line1\nline2"
doesn't work.

In a script it is possible to use two lines like this

dcop knotes KNotesIface newNote "title" "line1
line2"

but is this really the only possibility?

Thanks,
-- 
Rohan (Michael) Brade;         KDE Developer, Student of Computer Science
  |-mail: echo brade !#|tr -d "c oh"|s\e\d 's/e/\@/2;s/$/.org/;s/bra/k/2'
  °--web: http://www.kde.org/people/michaelb.html

KDE 4: Beyond Your Expectations

["geo.patch" (text/x-diff)]

Index: KNotesAppIface.h
===================================================================
--- KNotesAppIface.h	(revision 550490)
+++ KNotesAppIface.h	(working copy)
@@ -158,6 +158,36 @@
     virtual ASYNC hideAllNotes() const = 0;

     /**
+     * Returns the width of a note.
+     * @param noteId the id of the note in question
+     * @return the width as a uint
+     */
+    virtual int width( const QString& noteId ) const = 0;
+
+    /**
+     * Returns the height of a note.
+     * @param noteId the id of the note in question
+     * @return the height as a uint
+     */
+    virtual int height( const QString& noteId ) const = 0;
+
+    /**
+     * Repositions a note.
+     * @param noteId the id of the note to be moved
+     * @param x the new x-coordinate of the note
+     * @param y the new y-coordinate of the note
+     */
+    virtual ASYNC move( const QString& noteId, int x, int y ) const = 0;
+
+    /**
+     * Changes the size of a note.
+     * @param noteId the id of the note to be resized
+     * @param width the new width of the note
+     * @param height the new height of the note
+     */
+    virtual ASYNC resize( const QString& noteId, int width, int height ) const = 0;
+
+    /**
      * This tells KNotes that a specific app has synchronized with all the notes.
      * @param app the app that has synced with KNotes
      */
Index: knotesapp.h
===================================================================
--- knotesapp.h	(revision 550490)
+++ knotesapp.h	(working copy)
@@ -80,6 +80,12 @@

     QMap<QString,QString> notes() const;

+    int width( const QString& noteId ) const;
+    int height( const QString& noteId ) const;
+
+    void move( const QString& noteId, int x, int y ) const;
+    void resize( const QString& noteId, int width, int height ) const;
+
     void sync( const QString& app );
     bool isNew( const QString& app, const QString& id ) const;
     bool isModified( const QString& app, const QString& id ) const;
Index: knotesapp.cpp
===================================================================
--- knotesapp.cpp	(revision 550490)
+++ knotesapp.cpp	(working copy)
@@ -382,6 +382,42 @@
         kdWarning(5500) << "setColor: no note with id: " << id << endl;
 }

+int KNotesApp::width( const QString& id ) const
+{
+    KNote* note = m_noteList[id];
+    if ( note )
+        return note->width();
+    else
+        return 0;
+}
+
+int KNotesApp::height( const QString& id ) const
+{
+    KNote* note = m_noteList[id];
+    if ( note )
+        return note->height();
+    else
+        return 0;
+}
+
+void KNotesApp::move( const QString& id, int x, int y ) const
+{
+    KNote* note = m_noteList[id];
+    if ( note )
+        return note->move( x, y );
+    else
+        kdWarning(5500) << "move: no note with id: " << id << endl;
+}
+
+void KNotesApp::resize( const QString& id, int width, int height ) const
+{
+    KNote* note = m_noteList[id];
+    if ( note )
+        return note->resize( width, height );
+    else
+        kdWarning(5500) << "resize: no note with id: " << id << endl;
+}
+
 void KNotesApp::sync( const QString& app )
 {
     QDictIterator<KNote> it( m_noteList );


[Attachment #6 (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic