With Akonadi most operations are running behind the scenes, carried out by background helper processes called Akonadi Agents.
While we do have respective progress monitoring in KMail2, users will eventually take advantage of fact that they are no longer tied to specific applications. At which point they might want to be able to check on the status of these background processes without launching some front end applications.
Back in April, during one of our development sprints, I've created a Plasma DataEngine which provides information about running Akonadi agents.
I was kind of hoping that somebody with actual widget skills would be curious enough to try some Plasma widgets on top of it, alas this didn't happen.
Therefore I sat down today and wrote one myself, using the opportuntiy to also have a first real attempt in doing some KDE<->JavaScript coding.
The code for it more or less looks like this:
layout = new LinearLayout( plasmoid );
layout.orientation = QtVertical;
engine = dataEngine( "akonadiagents" );
agents = engine.sources;
resources = new Array;
addAgent = function( name ) {
label = new IconWidget();
label.orientation = QtHorizontal;
layout.addItem( label );
resources[ name ] = label;
engine.connectSource( name, plasmoid );
}
plasmoid.dataUpdated = function( name, data ) {
label = resources[ name ];
label.text = data.name;
label.icon = data.typeIcon;
label.infoText = data.statusMessage;
if ( !data.online ) {
label.enabled = false;
} else {
label.enabled = true;
if ( data.status == 1 ) { // running
label.infoText = data.statusMessage + " (" + data.progress + "%)";
}
}
}
while ( agents.length > 0 ) {
agent = agents.pop();
// ideally this would be using the agent type's capabilities, but the DataEngine::Data as returned by
// DataEngine::query() is not accessible from within JavaScript (or at least nobody on #plasma knew)
if ( agent.indexOf( "resource" ) != -1 ) {
addAgent( agent );
}
}
I am sure this is not very pretty from the point of view of skilled JavaScript users, you are welcome to beat me on that 
Anyway, screen cast of the Plasmoid in action, as usual on blip.tv
It shows the widget running in plasmoidviewer side by side with Akonadiconsole to demonstrate that the data engine really exposes the same data.
I start with toggling a local VCard file resource between Offline and Online state, which the widget visualizes by disabling/enabling the respective item.
Finally I synchronize all collections of the IMAP resource, showing status and progres reporting.
>
Read More... |
Digg This!
The Smoke based QtScript bindings are progressing well, and are now called 'JSmoke' in the style of 'JQuery' the JavaScript library or 'JScript' the .NET JavaScript implementation. In KDE promo-like words, I hope this will 'raise the brand recognition' of the state of the art KDE Smoke dynamic language bindings technology.
The project now has 24 QtScript plugins for the following libraries:
qtcore
qtdbus
qtgui
qtmultimedia
qtnetwork
qtopengl
qtsql
qtsvg
qtuitools
qtwebkit
qtxml
qtxmlpatterns
kdecore
kdeui
kfile
khtml
kio
knewstuff2
knewstuff3
kparts
ktexteditor
kutils
plasma
solid
There is a common 'libjsmokeruntime' lib that the plugins share. For running scripts there are two executables 'jsmokeapp' and 'jsmokecoreapp' for GUI and command line apps respectively. 'jsmokeapp' loads the qtcore and qtgui plugins and starts a QApplication. There still needs to be a 'jsmokekapp' which will start a KApplication, load the base KDE plugins, and run a KDE based script. Today I got a half Qt/half KDE app working. Here is the code:
qs.script.importExtension("jsmoke.kdecore");
qs.script.importExtension("jsmoke.kdeui");
qs.script.importExtension("jsmoke.kio");
function MainWindow(name) {
KMainWindow.call(this, name);
this.setObjectName(name);
this.setCaption("KDE Tutorial - p3");
var filemenu = new QMenu("&File", this);
var openAction = new QAction("&Open", this);
openAction.triggered.connect(this, this.fileOpen);
filemenu.addAction(openAction);
var saveAction = new QAction("&Save", this);
saveAction.triggered.connect(this, this.fileSave);
filemenu.addAction(saveAction);
var quitAction = new QAction("&Quit", this);
quitAction.triggered.connect(QCoreApplication.instance(), QCoreApplication.instance().quit);
filemenu.addAction(quitAction);
var about = "p3 1.0nn" +
"(C) 1999-2002 Antonio Larrosa Jimenezn" +
"larrosa@kde.orgttantlarr@supercable.esn" +
"Malaga (Spain)nn" +
"Simple KDE Tutorialn" +
"This tutorial comes with ABSOLUTELY NO WARRANTYn" +
"This is free software, and you are welcome to redistribute itn" +
"under certain conditionsn";
helpmenu = this.helpMenu(about);
var menu = this.menuBar();
menu.addMenu(filemenu);
menu.addSeparator();
menu.addMenu(helpmenu);
var hello = new QTextEdit(
"<H2>Hello World !</H2><BR>This is a simple" +
" window with <I><font size=5><B>R<font color=red" +
" size=5>ich </font><font color=blue size=5>Text" +
"</font></B></I> capabilities<BR>Try to resize" +
" this window, all this is automatic !", this );
this.setCentralWidget(hello);
}
MainWindow.prototype = new KMainWindow();
MainWindow.prototype.fileOpen = function() {
var filename = KFileDialog.getOpenUrl(new KUrl(), "*", this);
var msg = ("Now this app should open the url " + filename);
KMessageBox.information(null, msg, "Information", "fileOpenInformationDialog");
}
MainWindow.prototype.fileSave = function() {
var filename = KFileDialog.getSaveUrl(new KUrl(), "*", this);
}
window = new MainWindow("Tutorial - p3");
window.resize(400, 300);
window.show();
QCoreApplication.instance().exec();
Today I also got the code working with Qt 4.6 pretty much. There is still a problem with setting QObject properties, although reading QProperties works fine. This is unfortunate because most of the examples set QProperties, and don't work with Qt 4.6. You need to build all the smoke libs in the trunk kdebindings, before you will be able get all the plugins to link. To build with Qt 4.5, you will need to disable the KDE plugins and QtMultimedia.
What is there still to be done? Well, loads of things. But I feel the bindings are starting to be useful, as they now have pretty complete coverage of Qt 4.6 and the KDE 4.4 kdelibs classes. The names and general structure of the project are in place, and it is now a proper KDE project - you are very welcome to try it out provide feedback, and help finish it off..
>
Read More... |
Digg This!