This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Currency Converter

Tags: None
(comma "," separated)
tommydanger
Registered Member
Posts
9
Karma
0

Currency Converter

Tue Oct 28, 2008 9:56 pm
Hi
I've been using Linux daily for the last 3 years now.
Started with KDE3, switched to Gnome and now back to KDE with the wonderful 4.0 release :)

I'm a fairly experienced C programmer with some C++ skills and after reading some documents about the new internal kde libraries set for 4.x, I want to give something back to KDE. After years of using it I want to contribute :-)

However the tutorials at techbase aren't really helping, they just spread over several links :-(

Anyway, to get used to the KDE API (having worked with Qt before) I thought a currency converter(Kurrency :lightbulb:) would be a nice app. I often find myself switching to google to convert currency.
The app gets the up to date currency in .xml form from http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml
Possibly making use of the awesome Plasma engine ;-)
This app should act as a playground for me to get into KDE programming, however it would be nice if someone can assist me in setting up the development environment :-)


tommydanger, proud to be a member of KDE forums since 2008-Oct.
User avatar
Hans
Administrator
Posts
3304
Karma
24
OS

RE: Currency Converter

Tue Oct 28, 2008 10:32 pm
tommydanger wrote:however it would be nice if someone can assist me in setting up the development environment :-)


Have you checked http://techbase.kde.org/Getting_Started/Build/KDE4 and http://techbase.kde.org/Getting_Started ... esvn-build ?

It would be nice with a currency converter in KRunner, have you thought about making a Runner? Well, a plasmoid would be cool too!

I'm not very good at programming but try to learn more C++/Qt when I have time, which unfortunately seems to be 'never' nowadays. Your post motivated my to pick it up again. :-)
Sounds like a fun project, I wish you good luck with Kurrency. (But if you want to follow the trends, it should be called Currency. ;-))


Problem solved? Please click on "Accept this answer" below the post with the best answer to mark your topic as solved.

10 things you might want to do in KDE | Open menu with Super key | Mouse shortcuts
Kryten2X4B
Registered Member
Posts
911
Karma
4
OS

RE: Currency Converter

Tue Oct 28, 2008 11:30 pm
Not to discourage you or anything, but you may want to find another project...or contribute to the currency converter already available:

http://opensource.bureau-cornavin.com/keurocalc/


OpenSUSE 11.4, 64-bit with KDE 4.6.4
Proud to be a member of KDE forums since 2008-Oct.
tommydanger
Registered Member
Posts
9
Karma
0

RE: Currency Converter

Wed Oct 29, 2008 6:44 pm
No keurocalc isn't quiet what I had in mind ;)
After thinking more about it today, krunner seems the ideal place for it, as an extension
Press alt+f2 to fire it up and write for example 10 pounds in euro
But I couldn't find any information on how to write a krunner plugin, I took a quick look at the code though.
I think this is a nice thing to start kde dev and do some hacking ;)

On a side note I see a lot of potential for krunner, like using mail to any recipient to fire up kmail and write a mail to said recipient or get events in november to list all the november events from korganizer, shouldn't be that hard to implement with akonadi ;) Quick and easy for max usability.
I don't know the roadmap for krunner and wether the krunner developers thought of that but I would like to see something like that.

Anyway, if anyone has any information about krunner plugins please enlighten me :-D


tommydanger, proud to be a member of KDE forums since 2008-Oct.
User avatar
msoeken
Mentor
Posts
300
Karma
4
OS

RE: Currency Converter

Wed Oct 29, 2008 7:56 pm
Perhaps you can have a look at http://websvn.kde.org/trunk/KDE/kdebase/workspace/plasma/runners/calculator/. There is the calculator runner for krunner.

Cheers, m.


Image
[size=x-small]code | [url=cia.vc/stats/author/msoeken]cia.vc[/url] | [url=kde.org/support]donating KDE[/url] | [url=tinyurl.com/cto4ns]wishlist[/url][/size]
tommydanger
Registered Member
Posts
9
Karma
0

RE: Currency Converter

Wed Oct 29, 2008 10:14 pm
thanks a ton :)
just what I needed, a nice small example
however:
Code: Select all
        Plasma::QueryMatch match(this);
        match.setType(Plasma::QueryMatch::InformationalMatch);
        match.setIcon(KIcon("accessories-calculator"));
        match.setText(result);
        match.setData("= " + result);
        [b]match.setId(QString());[/b]
        context.addMatch(term, match);

Sets the id for this match; useful if the id does not match data().toString().

The id must be unique to all matches from this runner, and should remain constant for the same query for best results.

Parameters:
id the new identifying string to use to refer to this entry

Is this the usual way to do this? Why did they do this this way? From my understanding, when dealing with id's you have to store it somewhere to get access later on, but in this case?

also ::setText refers to the label right beneath the input box and beneath the icon?
Image

::setData is the text in the inputbox after you've pressed enter?
Image

also where do I get a list of the available icons?

thanks in advance

All I need now is a working dev environment :thumbs_up:


tommydanger, proud to be a member of KDE forums since 2008-Oct.
User avatar
msoeken
Mentor
Posts
300
Karma
4
OS

RE: Currency Converter

Thu Oct 30, 2008 7:14 am
I have not implemented a runner by now, but perhaps I can answer some of your questions.

tommydanger wrote:Is this the usual way to do this? Why did they do this this way? From my understanding, when dealing with id's you have to store it somewhere to get access later on, but in this case?


If this works with the calculator, it should also work with your currency converter. I think that the id is only necessary if you have more than one icon.

tommydanger wrote:also ::setText refers to the label right beneath the input box and beneath the icon?

I think so.

tommydanger wrote:::setData is the text in the inputbox after you've pressed enter?

Probably this do not have to be the case. But it makes sense in this way.

tommydanger wrote:also where do I get a list of the available icons?


http://websvn.kde.org/trunk/KDE/kdebase/runtime/pics/oxygen/

tommydanger wrote:All I need now is a working dev environment :thumbs_up:


http://techbase.kde.org/Getting_Started/Build/kdesvn-build

Cheers, m.


Image
[size=x-small]code | [url=cia.vc/stats/author/msoeken]cia.vc[/url] | [url=kde.org/support]donating KDE[/url] | [url=tinyurl.com/cto4ns]wishlist[/url][/size]
mat69
KDE Developer
Posts
45
Karma
0

RE: Currency Converter

Thu Oct 30, 2008 11:05 am
Do you want to implement every currency listed there?
Like "JPY to USD".

Btw. how do you also want to show the currency rate? And if, by price or amount?
In the Euro-zone the exchange rate is by amount (1 EUR equals to XY in other currency) [1], while it's by price in most other countries ( 1 XY equals to Z USD).


[1] because they had not balls^^

Last edited by mat69 on Thu Oct 30, 2008 11:07 am, edited 1 time in total.


mat69, proud to be a member of KDE forums since 2008-Oct.
john_hudson
Registered Member
Posts
549
Karma
2
OS

RE: Currency Converter

Thu Oct 30, 2008 10:01 pm
As far as I understand it, KMyMoney uses a routine to convert currency. Why not check how far that has got and whether the ideas can be generalised into something which other applications can call on? KMyMoney is yet to be ported to Qt4; so there may be some work to do there.


John Hudson, proud to be a member of KDE forums since 2008-Oct.
User avatar
msoeken
Mentor
Posts
300
Karma
4
OS

RE: Currency Converter

Fri Oct 31, 2008 7:05 am
tommydanger wrote:Anyway, if anyone has any information about krunner plugins please enlighten me :-D


There is also a unit converter in kdeplasma-addons: http://websvn.kde.org/trunk/KDE/kdeplasma-addons/runners/converter/

Cheers, m.


Image
[size=x-small]code | [url=cia.vc/stats/author/msoeken]cia.vc[/url] | [url=kde.org/support]donating KDE[/url] | [url=tinyurl.com/cto4ns]wishlist[/url][/size]
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

RE: Currency Converter

Sat Nov 01, 2008 12:03 am
I will have to check that currency converter out in kdeplasma-addons. I have been wanting a currency converter for a while now ( when I compare prices to see how much gets added on by importers )


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
tommydanger
Registered Member
Posts
9
Karma
0

RE: Currency Converter

Fri Nov 14, 2008 11:44 pm
Ok so I set up my dev environment.
Works great, but how can I add my own runners, more essentially how can I test my runners the best way.
I compiled krunner from svn and did not have any runners available so I did a cmakekde for kdebase/workspace/plasma/runners/calculator, fired up krunner again but it was not listed until I did a re-login.
Now the calculator runner is present as the only runner, how expected, but it seems the runner doesn't get updated when I alter the code and compile it again via cmakekde ?
Have I missed something?
What is the basic workflow for a runner?
There's little to no information available on the net :(


tommydanger, proud to be a member of KDE forums since 2008-Oct.
User avatar
msoeken
Mentor
Posts
300
Karma
4
OS

RE: Currency Converter

Sat Nov 15, 2008 11:05 am
tommydanger wrote:Ok so I set up my dev environment.
Works great, but how can I add my own runners, more essentially how can I test my runners the best way.
I compiled krunner from svn and did not have any runners available so I did a cmakekde for kdebase/workspace/plasma/runners/calculator, fired up krunner again but it was not listed until I did a re-login.
Now the calculator runner is present as the only runner, how expected, but it seems the runner doesn't get updated when I alter the code and compile it again via cmakekde ?
Have I missed something?
What is the basic workflow for a runner?
There's little to no information available on the net :(


Does cmakekde call make install? Be sure to install your changes via make install. And you should check your paths. But they are normally set in .bashrc.


Image
[size=x-small]code | [url=cia.vc/stats/author/msoeken]cia.vc[/url] | [url=kde.org/support]donating KDE[/url] | [url=tinyurl.com/cto4ns]wishlist[/url][/size]
tommydanger
Registered Member
Posts
9
Karma
0

RE: Currency Converter

Sat Nov 15, 2008 8:51 pm
Well I've used the .bashrc example from the techbase tutorial.
Do I need to compile all of kdebase or is it enough to only compile runtime ?
Because when I tried to compile kdebase it broke at some point so I compiled runtime instead.

Another strange thing is when I log in to my dev account via sux and run krunner, I get loads of
krunner(6752)/libplasma Plasma::Theme::imagePath: Theme says: bad image path "dialogs/krunner"
and I don't see any krunner widget at all, which makes sense according to the debug message :D I see the entry on the taskbar at least. I can still type something and see the debug messages on the konsole.
However when I log in via kdm I can see the krunner widget but I don't get any debug messages at all, which makes me think it don't run the same krunner. When I navigate to the build dir and launch krunner from there, same thing, no debug messages, at least there should I get debug messages? but no :(

God, why do I have to write a runner, I should work on a normal app, I don't have any problems there


tommydanger, proud to be a member of KDE forums since 2008-Oct.
User avatar
msoeken
Mentor
Posts
300
Karma
4
OS

RE: Currency Converter

Sun Nov 16, 2008 9:47 am
tommydanger wrote:Do I need to compile all of kdebase or is it enough to only compile runtime ?


You should also compile kdebase-workspace because the "running" plasma lives here.

tommydanger wrote:Another strange thing is when I log in to my dev account via sux and run krunner, I get loads of
krunner(6752)/libplasma Plasma::Theme::imagePath: Theme says: bad image path "dialogs/krunner"
and I don't see any krunner widget at all, which makes sense according to the debug message :D I see the entry on the taskbar at least. I can still type something and see the debug messages on the konsole.
However when I log in via kdm I can see the krunner widget but I don't get any debug messages at all, which makes me think it don't run the same krunner. When I navigate to the build dir and launch krunner from there, same thing, no debug messages, at least there should I get debug messages? but no :(


Try to compile and install kdebase-workspace, too. Then you should login to your devel account via ssh -X and start plasma. Right click on the plasma shell and click "Run command". This should work.

Cheers, m


Image
[size=x-small]code | [url=cia.vc/stats/author/msoeken]cia.vc[/url] | [url=kde.org/support]donating KDE[/url] | [url=tinyurl.com/cto4ns]wishlist[/url][/size]


Bookmarks



Who is online

Registered users: bancha, Bing [Bot], Evergrowing, Google [Bot], lockheed, mesutakcan