Bug 69079 - Creating a new themes in the gallery the files are always created as file "new theme.*" instead of "sdxxx.*" - existing files will be overwritten and leads to data loss.
Summary: Creating a new themes in the gallery the files are always created as file "ne...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
4.1.0.4 release
Hardware: x86 (IA32) Windows (All)
: medium major
Assignee: Not Assigned
URL:
Whiteboard: target:4.2.0 target:4.1.4
Keywords: difficultyBeginner, easyHack, skillCpp, topicCleanup
Depends on:
Blocks: 67274
  Show dependency treegraph
 
Reported: 2013-09-07 23:03 UTC by CassieLX
Modified: 2016-02-18 16:37 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description CassieLX 2013-09-07 23:03:14 UTC
Creating a new themes in the gallery the files are always created as file "new theme.*" instead of "sdxxx.*" - existing files will be overwritten.

If a new theme is created in the gallery two files are created:
"new theme.sdv" and "new theme.thm"
If I simply name the theme for example to "1-TEST" the filename leave unchanged.

Now I can drag and drop a drawing object into the gallery window and it will be stored in the file "new theme.sdg", a folder dragdrop appears and another file "sdddndx1" is created.

If I add a second theme the file "new theme.thm" and "new theme.sdv" are overwritten by "New theme.thm" (first character large!) and "new theme.sdv" after i give this theme a name (For example "2-TEST" the file is stored as "new theme.thm" again.

If I drop an object into one of these two new themes the graphic object appears in booth (!) themes at the same time.

In fact, the user can only create one theme in the gallery.

As a workaround I can rename the files manually to another name, for example "1-TEST.thm", "1-TEST.sdv" and "1-TEST.sdg", after that i can create a new theme (of course with the name "new theme.*" again)

In my opinion the routine of renaming the files is broken. Normally the gallery files are stored as sgxx.* with upcounting numbering.
Personally I would prefer if the names are corresponding with the theme name in the gallery.

I have test it with WindowsXP (LibO 4.1.0.4), Windows7(LibO4.1.1.2) and with Ubuntu 12.04.3LTS (LibO Master 4.2.0.0 Aplpha)
Comment 1 sophie 2013-09-10 15:27:48 UTC
I can confirm with Version: 4.1.2.1
Build ID: bf15ac65c2167fb1ef3daf3710609d4a4c369a9 Linux 64 version. 
Any time you add a new theme, the objects in the previous ones are replaced by the latest. I've created 3 new themes, at the end, they all have the same pictures in it for the reasons Papamatti explains. For the moment, it's impossible to add new themes in the Gallery. Sophie
Comment 2 sophie 2013-09-12 16:24:50 UTC
@Papamatti: I'm lowering the priority as there is no data loss, objects are linked not embedded, so you still can access them - Sophie
Comment 3 Michael Meeks 2013-09-12 16:27:19 UTC
This is my bug - sorry for that; the good news is the themes can be translated by anyone now with a .desktop file syntax; and the workaround is to manually rename them.

This is also almost certainly an easy hack; to just check that the theme filename does not exist already.

svx/source/gallery2/gallery1.cxx - and thereabouts would be a great place to poke I think.

Anything emitting:

        Broadcast( GalleryHint( GALLERY_HINT_THEME_CREATED, rThemeName ) );

is prolly something to poke :-)
Comment 4 CassieLX 2013-09-12 19:12:17 UTC
(In reply to comment #2)
> @Papamatti: I'm lowering the priority as there is no data loss, objects are
> linked not embedded, so you still can access them - Sophie

To reproduce data loss:
- Create two themes and drop some objects in it.
- Close LibreOffice
- Open LibreOffice

You see only one of the new created themes remains.

- Create a new theme

You can now see the new theme has no objects in it, BUT, the objects of the previous created theme are gone, also.

In my opinion data loss.

If you create two themes and you delete one of them, the two "new theme.*" will be deleted and all data in them are lost.

But this is simply a naming issue, i would happily fix it myself but i have too less knowledge about the mechanic of the source code of LibO.
Comment 5 Samuel Mehrbrodt (allotropia) 2013-10-01 21:14:35 UTC
This is a MAB.
Comment 6 Michael Meeks 2013-10-02 08:41:58 UTC
> But this is simply a naming issue, i would happily fix it myself but
> i have too less knowledge about the mechanic of the source code of LibO.

I've given the file paths; this is an easy-hack / entry level problem for a developer. cf. http://cgit.freedesktop.org/libreoffice/core/tree/svx/source/gallery2
Comment 7 Björn Michaelsen 2013-10-04 18:47:26 UTC
adding LibreOffice developer list as CC to unresolved EasyHacks for better visibility.

see e.g. http://nabble.documentfoundation.org/minutes-of-ESC-call-td4076214.html for details
Comment 8 Robinson Tryon (qubit) 2013-10-19 00:22:50 UTC
Removing comma from whiteboard (please use a space to delimit values in this field)
https://wiki.documentfoundation.org/QA/Bugzilla/Fields/Whiteboard#Getting_Started
Comment 9 Michael Meeks 2013-10-24 12:30:39 UTC
Fixed on master, and pending back-port to 4-1 as: https://gerrit.libreoffice.org/6417
Comment 10 Commit Notification 2013-10-24 12:33:23 UTC
Michael Meeks committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=398519cb61b3aa2df61b9b18724ced4a36eb39d6

fdo#69079 - fix multiple user gallery creations.



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 11 Commit Notification 2013-10-29 12:13:44 UTC
Michael Meeks committed a patch related to this issue.
It has been pushed to "libreoffice-4-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=41102212d49fd18643bba375d65963bd41008bc7&h=libreoffice-4-1

fdo#69079 - fix multiple user gallery creations.


It will be available in LibreOffice 4.1.4.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 12 Peter Mögenburg 2014-03-16 08:23:12 UTC
Problem is also in version 4.2.2 and 4.2.3.1 .
Comment 13 Chris Sherlock 2014-03-17 02:25:09 UTC
Peter, are you saying this is still an issue?

If so: we need to look at svx/source/gallery2/galbrws1.cxx - the file name is created using resource RID_SVXSTR_GALLERY_NEWTHEME. But it *should* be incrementing the name, but it will be "new themeXX".
Comment 14 Michael Meeks 2014-03-17 09:21:35 UTC
Right - should be fixed in 4.1.4 and all 4.2.x and master etc. long ago =) perhaps I screwed something up, wouldn't be the first time of course.
Comment 15 Chris Sherlock 2014-03-19 13:12:29 UTC
What do we want to call the themes? do we want them to be sdxxx.*

If so, should be easy for me to fix this. Happy to do so if this is what is required.
Comment 16 Michael Meeks 2014-03-19 14:26:24 UTC
Of course, we could provide the user with an option, or use a mangled version of their theme name, or use sdXXX<next> - but ... I really thought I fixed that ;-)
Comment 17 Chris Sherlock 2014-03-20 16:09:20 UTC
I've been wrong before :-) I'll recheck.
Comment 18 Robinson Tryon (qubit) 2015-12-15 22:49:58 UTC
Migrating Whiteboard tags to Keywords: (EasyHack DifficultyBeginner SkillCpp TopicCleanup )
[NinjaEdit]
Comment 19 Robinson Tryon (qubit) 2016-02-18 16:37:24 UTC
Remove LibreOffice Dev List from CC on EasyHacks
(curtailing excessive email to list)
[NinjaEdit]