Bug 281268 - It's possible to create and save profile whose name is empty.
Summary: It's possible to create and save profile whose name is empty.
Status: RESOLVED FIXED
Alias: None
Product: konsole
Classification: Applications
Component: general (show other bugs)
Version: 2.7.999
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-03 13:29 UTC by Jekyll Wu
Modified: 2011-09-14 15:44 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 4.8


Attachments
profile-with-empty-name (94.20 KB, image/png)
2011-09-03 13:29 UTC, Jekyll Wu
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jekyll Wu 2011-09-03 13:29:47 UTC
Created attachment 63355 [details]
profile-with-empty-name

Version:           2.7.999 (using KDE 4.7.0) 
OS:                Linux

A profile with empty name might be created and saved in some situation. This is not quite intuitive and might make users confused.

Reproducible: Didn't try

Steps to Reproduce:
1. execute 'konsoleprofile ShowMenuBar=trueb' within some session of konsole.
2. open the 'Edit Current Profile' dialog, where the profile name is displayed as empty.
3. change some option and click 'OK' button to close that dialog.
4. close konsole and open it again.


Actual Results:  
A file named as '.profile'(hidden) is saved under ~/.kde4/share/apps/konsole/ , and the 'Config Profiles' dialog will display a profile whose name is empty.


Expected Results:  
A profile with emtpy name should never be saved into disk.
Comment 1 Grissiom 2011-09-03 14:45:03 UTC
Make runtime profiles hidden

Runtime profile might be considered as overlay profiles that handle the profile command sequence. So make it hidden.
==================================
diff --git a/src/SessionManager.cpp b/src/SessionManager.cpp
index 5d5aecc..4a736fe 100644
--- a/src/SessionManager.cpp
+++ b/src/SessionManager.cpp
@@ -771,6 +771,7 @@ void SessionManager::sessionProfileCommandReceived(const QString& text)
     if ( !_sessionRuntimeProfiles.contains(session) )
     {
         newProfile = new Profile(_sessionProfiles[session]);
+        newProfile->setHidden(true);
         _sessionRuntimeProfiles.insert(session,newProfile);
     }
     else
Comment 2 Jekyll Wu 2011-09-04 05:42:06 UTC
(In reply to comment #1)
> 

Thanks for your kindness of helping. But that hidden property of dynamically-created profile is not the cure of this problem. The real problem is konsole does not check whether name is empty when asked to save a profile into disk(persistent).

Here is another way to reproduce the problem:

1). open the 'Config profiles' dialog
2). click 'New profile' .
3). set profile name to empty
4). press 'OK'
5). that new profile is saved as '.profile' under ~/.kde4/share/apps/konsole/

I actually already have some idea about how to deal with empty profile name in a more intuitive way. I will submit it to reviewboard when I am sure it does work and does not cause regression.
Comment 3 Jekyll Wu 2011-09-14 15:44:24 UTC
Git commit 49c107966bbea1e7f57329bf281cd0cabffc5280 by Jekyll Wu.
Committed on 14/09/2011 at 17:31.
Pushed by jekyllwu into branch 'master'.

Konsole should never save a profile with empty name into disk.

BUG: 281268
FIXED-IN: 4.8
REVIEW:102559

M  +21   -0    src/EditProfileDialog.cpp
M  +21   -17   src/EditProfileDialog.ui
M  +5    -1    src/SessionManager.cpp

http://commits.kde.org/konsole/49c107966bbea1e7f57329bf281cd0cabffc5280