Changing "Open new conversations:" setting in ktp-text-ui only applies after restarting ktp-text-ui. Till then it don't have any effect. Reproducible: Always Steps to Reproduce: 1. Open a text chat with user A from ktp-contactlist. 2. Change "Open new conversations:" to "As tabs in the same window". Exit with "OK" here. 3. Close ktp-text-ui 4. Open a text chat with user A from ktp-contactlist. 5. Change "Open new conversations:" to "As new windows". Exit with "OK" here. 6. Open a text chat with user B from ktp-contactlist. Actual Results: A new tab with the chat with user B opens. Expected Results: A new window with the chat with user B opens.
*** Bug 305159 has been marked as a duplicate of this bug. ***
Currently this happens as I understand the problem: ktp-text-ui starts and reads the settings from file. These settings are in effect until ktp-text-ui terminates. The configuration dialog changes these settings independently in the file but don't communicate the change back anywhere to the rest of the running ktp-text-ui. So I think a singleton shared by ktp-text-ui and it's configuration dialog should help here. It could hold the current configuration and allow to change it. Whenever ktp-text-ui needs any configurable value it will ask this singleton. Changes would take effect immediately then. Would then also come in handy for bug 282201 (this is about allowing to turn "User is tpying" on and off) as the settings needed could be placed in the singleton, too. I intend to give this idea a try and see if it works.
You don't necessarily need to mess with singletons, you can just emit a signal in void ChatWindow::showSettingsDialog() once the dialog is destroyed, then just connect to that signal in TelepathyChatUi and reparse the configuration and apply the changes. Maybe you'll find even more elegant solution ;)
Then you need ChatWindow to propogate signals so the chat-ui can see them.. and then it has to know to reparse it. I'd be ok with a singleton in this particular case.. If you want to show us a rough example of the header file of this before you proceed I'd be happy to look.
The tabOpenMode setting is parsed and stored in TelepathyChatUi, so you need to get the signal there somehow anyway; besides TelepathyChatUi creates ChatWindows and does connect to its signals already. So it would be just a matter of adding one connection there (telepathy-chat-ui.cpp:71)
TeleapthyChatUi needs to reload it's instance variables plus the ChatWindow needs to relay this . vs (in the chat ui) switch (Config::instance()->windowOpenMode() ) { } and in the chat window Config::instance()->showSettingsDialog() with all connections inside config.
Ok, since we need to actually apply the settings in multiple classes and propagating the changes would be difficult, config singleton does look like a better idea (I was thinking about changes only to the tab opening option). So all interested classes can connect to the config changes signal and update their settings.
Created attachment 77713 [details] text-chat-config.h The singleton for the configuration settings.
Looking good! Small note - "getInstance();" -> in Qt/KDE world, we don't use the "get" keyword, so just use "instance();" ;)
Git commit 1b1ea8a533f72b3ccfeec554a3657ecaa9a6836e by David Edmundson, on behalf of Stefan Eggers. Committed on 04/03/2013 at 12:55. Pushed by davidedmundson into branch 'master'. Combining settings in a singleton class so that there is no confusion about the current settings. Up to now the settings for where new chats open were loaded by ktp-text-ui on startup and not re-read anymore. Changing the settings in the config dialog had no immediate effect; only after the next start of ktp-text-ui it finally changed. Now whenever the settings get asked for the singleton provides the current value. Thus every change to the settings via the config dialog will take effect immediately. Also gives a way to easily add new settings in one place. Will be useful for implementing the additional settings required by bug 282201 (make it configurable if "user is typing" gets show") which needs two more bools. DIGEST: REVIEW: 109268 M +4 -15 app/telepathy-chat-ui.cpp M +0 -7 app/telepathy-chat-ui.h M +8 -30 config/behavior-config.cpp M +2 -2 config/behavior-config.h M +3 -0 lib/CMakeLists.txt A +6 -0 lib/KTp/TextChatConfig A +143 -0 lib/text-chat-config.cpp [License: GPL (v2+)] C +28 -26 lib/text-chat-config.h [from: config/behavior-config.h - 062% similarity] [License: GPL] http://commits.kde.org/telepathy-text-ui/1b1ea8a533f72b3ccfeec554a3657ecaa9a6836e