Some changes on kio/kio/jobuidelegate

Rafael Fernández López ereslibre at gmail.com
Thu Dec 28 15:37:05 GMT 2006


Hi,

For simplifying the code on kio/kio/jobuidelegate.h and
kio/kio/jobuidelegate.cpp, I have seen that internalAppName and appName are
not needed methods. The Observer will read those values and send them to the
UI Server. So on monday I will commit the attached patch if no objections.

Some changes have been done:

* In order of painting icons nicely we don't have to pass through dbus to
the ui server the full icon path. We will just send the icon name, and then
the UI Server will try to load it from the svg icon as the height requested
by the delegate. So we can't force it on the jobuidelegate to any size,
because the delegate will be the one that will request this or that height
in runtime.

To understand this, you can visit
http://www.ereslibre.es/kdedev/screenshot2.png

* I'm adding new code to the observer. Right now *ALL* things added to the
observer are *REAL* KIO::Jobs. Now I am extending this to let apps that
don't throw real jobs show some progresses on the UI Server. That is being
done with a new method on observer.h/cpp (basically, but extended for lots
more slots, for setting data):

  /**
   * Called by the job constructor, to signal its presence to the
   * UI Server.
   * @param job the new job
   * @param showProgress true to show progress, false otherwise
   * @return the progress ID assigned by the UI Server to the Job.
   */
  int newJob( KIO::Job * job, bool showProgress );

  /**
   * If you don't have a KIO::Job, but want to show some kind of
   * progress into the UI Server, you have to call this method.
   * @param icon the icon to be shown on the UI Server
   * @return the progress ID assigned by the UI Server
   */
  int newJob( const QString &icon = QString() );

And then, you only will have to call the *NEW* slots, that are of this form:

void slotInfoMessage( int jobId, const QString & msg );
.
.
.

With the int that newJob returned (that is the jobId). So now, you can set
percent... and so on for "virtual" jobs, jobs that aren't KIO::Jobs, but
jobs your application. This way you can call it:

int thisNewJob = Observer::self()->newJob("receivingmail"); // if we had a
svg icon file "receivingmail.svgz" that lets us retrieve the icon with the
height we want (automatically on UI Server)

or

int thisOtherNewJob = Observer::self()->newJob();

and then for example:

Observer::self->slotInfoMessage( thisOtherNewJob, i18n("Retrieving mail from
server...") );

Then on your code (where you are progressing), you can be updating
Observer::self->slotPercent( thisOtherNewJob, myPercent );

so it is updated on the UI Server.

Any comments ?

Bye,
Rafael Fernández López.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20061228/d04c909c/attachment.htm>


More information about the kde-core-devel mailing list