[PATCH] KNotes: geometry DCOP functions, DCOP newlines question

Thiago Macieira thiago at kde.org
Sat Jul 8 08:26:29 BST 2006

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

Let's see what Cornelius says, but the patch at least looks fine.

The only thing I am not sure about is using kdWarning() to relay errors to 
user interaction. Maybe you should make it return bool instead of ASYNC?

>And I have another problem: is it possible to add newline characters
> with DCOP somehow? 

Yes, just send strings that contain newlines, as many as you want. Strings 
can actually contain anything, including NUL (U+0000) characters, because 
QString supports them.

> This 
>  dcop knotes KNotesIface newNote "title" "line1\nline2"
>doesn't work.

Well, that's a slash and an N, not a newline. You're writing shell code, 
not C++ code. You have to use whatever method your sh uses to embed 
newlines into its string literals.

>In a script it is possible to use two lines like this
>dcop knotes KNotesIface newNote "title" "line1
>but is this really the only possibility?

Hmm... no. You can set a variable to it, like:

And then embed it in your text like:
dcop knotes KNotesIface newNote "title" "line1${n}line2"

I used to do this a lot in Pascal in the 90s because writing:
  'This is a line' + crlf + 'This is another line'

is much easier than:
  'This is a line' + chr(13) + chr(10) + 'This is another line'

  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20060708/06d299f3/attachment.sig>

More information about the kde-core-devel mailing list