Bug 193989 - relocate/open new database
Summary: relocate/open new database
Status: CONFIRMED
Alias: None
Product: kphotoalbum
Classification: Applications
Component: general (show other bugs)
Version: SVN trunk (KDE4 version)
Platform: Unlisted Binaries Linux
: NOR wishlist
Target Milestone: ---
Assignee: KPhotoAlbum Bugs
URL:
Keywords: junior-jobs
Depends on:
Blocks:
 
Reported: 2009-05-25 07:46 UTC by Jesper Pedersen
Modified: 2010-01-04 23:05 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Patch for 193989 (3.26 KB, patch)
2009-07-05 19:18 UTC, Alex
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jesper Pedersen 2009-05-25 07:46:05 UTC
It should be possible from KPA to open a new database from the GUI of KPA. It should also be possible to relocate the default one, ie. tell KPA about a new default database
Comment 1 Jesper Pedersen 2009-06-11 21:00:44 UTC
Here are some hints to this:
* The menu of the application is set up using the file kphotoalbumui.rc in the home direction. Make sure to run make install each time you've edited it.
* make sure to bounce the version number up once when you are doing these changes. (version number is on the second line of the file)
* Once you have added the menu entry to this file, you also need to hook it up in MainWindow/Window.cpp (see how it is done for e.g. _deleteSelected)
* I somehow doubt that KPhotoAlbum can be reinitialized with a new database, but you should be able to start a new instance rather easy. We already do this using Help->Run KPhotoAlbum demo.
* KPhotoAlbum also have support for running with a different database. See MainWindow::Window::load() where we check for the command line argument -c

Regarding relocation of the database. That ought to be as simple as changing the value in the settings database. Again see MainWindow::Window::load for details on how KPhotoAlbum decides where the database is in the first place.
Comment 2 Alex 2009-06-30 22:17:33 UTC
This can be added to the general database setup in the Settings. The SQL databases are already being configured there (even if it is experimental) so if I add an extra line in "XML Database Settings" to specify the current config file, then it can be changed when you want to move to a different one there, rather than putting more dialogs in the menu. Just like SQLite db file.
Comment 3 Jesper Pedersen 2009-07-01 21:04:50 UTC
That might indeed be a way to solve it.
Still that doesn't allow the user to open another database from the GUI. I can't really see the usecase for why you would like to do that, but I've heard that request often.
Comment 4 Alex 2009-07-05 19:18:13 UTC
Created attachment 35066 [details]
Patch for 193989

Added the box for the XML database location in the settings menu. Plus a message box to tell the user to restart the kphotoalbum because they have changed the database.

There is a slight issue with that. If the xml file is empty the kphotoalbum will fall over backwards and not work. I don't know whether there should be a check during startup for that or when the database is changed.
Comment 5 Jesper Pedersen 2009-07-11 16:16:08 UTC
A few things I'd like to see changed before I apply this patch. And I admit it is perhaps my mistake for not thinking this though before hand, I'm sorry for the extra work that gave you.

What does it mean to change the backend? Will the index.xml file be moved, or will we use a new index.xml file? If it will be moved, can KPA at all cope with that (I dont think so, I think it is an implicit rule that the index.xml file must be located in the root of the image directory). If it means that it will use a different index.xml file, then maybe the text should say something like "default kphotoalbum directory", to indicate to the user that this simply specify which directory it will use by default.

In addition to that, I think it is important to add a "open different KPA directory" to the file menu, so it is more explicit to the user that he can do that too.

Finally, you bring up a dialog box telling the user to restart, how about instead do this:
1) check if the user have any changes, if so, ask if they should be saved, and if so save. (The usual "save", "dont save", "cancel" dialog).
2) start the new KPA yourself (you may see how this is done from the menu Help->start demo database, there we already start a new KPA instance)
3) close your current instance.

In addition to that, but please make that a separate patch, maybe it would be good if you could specify a index.xml directly on the command line (or even simply a directory, as I beleive it must be called index.xml), instead of having to do so using the -c switch.


Thanks
Jesper
Comment 6 Jesper Pedersen 2010-01-04 23:05:32 UTC
Hi Alex, wanna go for another round with this patch?

Cheers
Jesper.