auto adding extension

Bug #309525 reported by Daniël H.
2
Affects Status Importance Assigned to Milestone
OpenTeacher
Fix Released
Medium
Marten de Vries

Bug Description

Automatically adding extension / automatically save as the right file format when selecting a file format in the save (as) >Files of type dialog.

Revision history for this message
Milan Boers (milan-boers) wrote :

Yep, I tried that, but I have no idea how. If anyone can help me out, I would love to.

Changed in openteacher:
status: New → Confirmed
Revision history for this message
Roel Huybrechts (rulus) wrote :

I tried fixing this issue, patch attached. Needs testing though.

Changed in openteacher:
assignee: nobody → rulus
Revision history for this message
Roel Huybrechts (rulus) wrote :

Hmm, I don't know how to merge the two patches, so you should apply this one after the first one.

Changed in openteacher:
status: Confirmed → In Progress
Revision history for this message
Milan Boers (milan-boers) wrote :

Thank you. Added your patches, but there's one little problem.
I save the file with filename "hoi" where filter is .t2k, so it saves as hoi.t2k. That works fine.
But when I do that again, it doen't ask to to overwrite.

Revision history for this message
Roel Huybrechts (rulus) wrote :

Yes, I discovered that one too a minute ago, I'll check where it goes wrong. In the mean time, I have another patch for you :)
Sometimes the extension was added twice, this should be fixed with attached patch.

Revision history for this message
Milan Boers (milan-boers) wrote :

Thanks :) I just fixed a bug that sometimes the Save wasn't shown when it should be.

Revision history for this message
Roel Huybrechts (rulus) wrote :

I forgot to add a revision in the first patch; it's attached now.

Revision history for this message
Roel Huybrechts (rulus) wrote :

Patch to dynamically add the extension to the selected file in the save dialog, based on the selected filter. This ensures there will be asked a confirmation before overwriting an existing file.

Revision history for this message
Daniël H. (daan-is-here) wrote :

Only add extension when extension not in filename.

Revision history for this message
Daniël H. (daan-is-here) wrote :

Maybe make a new variable for the supported extensions in a list? That avoids having to change all things when adding support for a new file format.

Revision history for this message
Daniël H. (daan-is-here) wrote :

hm patch doesn't work

Revision history for this message
Roel Huybrechts (rulus) wrote :

Improved confirmOverwrite.patch: save as .ot when no extension specified. Note: does not work when manually changing the extension after changing the filter.

Changed in openteacher:
assignee: rulus → nobody
Revision history for this message
Roel Huybrechts (rulus) wrote :

I guess the best solution is to use the QFileDialog only to select a file/location to save, and show a separate confirmation dialog if that file already exists. Patch against current trunk is attached, needs excessive testing though.

Revision history for this message
Milan Boers (milan-boers) wrote :

Added the last patch to rev >= 26

Revision history for this message
Roel Huybrechts (rulus) wrote :

Only change saveFilename, update window title and disable save if actually saved the file. Needs testing.

Revision history for this message
Roel Huybrechts (rulus) wrote :

And we shouldn't clear the words table when the user pressed New, chose to save changes and then cancelled the operation.

Revision history for this message
Milan Boers (milan-boers) wrote :

Added your patched in respectively revision 46 and 47.

Revision history for this message
Milan Boers (milan-boers) wrote :

Uhh 47 and 48 I mean :)

Changed in openteacher:
status: In Progress → Fix Committed
Revision history for this message
Marten de Vries (marten-de-vries) wrote :

Still the saving dialog does show weird behaviour, and I have at other sources (the ubuntu-nl.org forum) seen complains that the dialog doesn't look native.

I'm going to mark this bug open again, maybe we can simply better use the default dialog of Qt. It doesn't have automatic extension adding, but more apps use it so I think users are used to that behaviour already.

Changed in openteacher:
importance: Undecided → Medium
status: Fix Committed → Confirmed
Revision history for this message
Marten de Vries (marten-de-vries) wrote :

I fixed it as one in a list of bugs sometime ago. (using the native file dialog.)

Changed in openteacher:
status: Confirmed → Fix Committed
status: Fix Committed → Fix Released
assignee: nobody → Marten de Vries (marten-de-vries)
milestone: none → 2.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.