2018-12-23 17:49:01 +01:00
/*******************************************************************************
* gui / settings / ChatPage . cpp *
* *
* Copyright 2006 , Retroshare Team < retroshare . project @ gmail . com > *
* *
* This program is free software : you can redistribute it and / or modify *
* it under the terms of the GNU Affero General Public License as *
* published by the Free Software Foundation , either version 3 of the *
* License , or ( at your option ) any later version . *
* *
* This program is distributed in the hope that it will be useful , *
* but WITHOUT ANY WARRANTY ; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the *
* GNU Affero General Public License for more details . *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program . If not , see < https : //www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2010-05-03 21:17:36 +00:00
2014-05-26 21:51:53 +00:00
# include <QColorDialog>
2013-06-16 14:39:44 +00:00
# include <QMenu>
# include <QMessageBox>
2010-09-07 15:49:31 +00:00
# include <time.h>
2010-05-03 21:17:36 +00:00
2012-10-27 15:51:34 +00:00
# include <retroshare/rsnotify.h>
2013-06-16 14:39:44 +00:00
# include <retroshare/rsmsgs.h>
# include <retroshare/rspeers.h>
2010-05-03 21:17:36 +00:00
# include "ChatPage.h"
2013-06-16 14:39:44 +00:00
# include <gui/RetroShareLink.h>
# include "gui/chat/ChatDialog.h"
2010-09-07 15:49:31 +00:00
# include "gui/notifyqt.h"
2010-07-23 18:52:58 +00:00
# include "rsharesettings.h"
2017-02-27 23:13:45 +01:00
# include "util/misc.h"
2017-01-23 00:25:17 +03:00
# include <retroshare/rsconfig.h>
2010-07-23 18:52:58 +00:00
2011-09-29 09:20:09 +00:00
# include <retroshare/rshistory.h>
2011-12-26 22:43:54 +00:00
# include <retroshare/rsmsgs.h>
2011-09-29 09:20:09 +00:00
2010-09-07 23:19:27 +00:00
# define VARIANT_STANDARD "Standard"
2020-02-22 01:26:20 +01:00
# define IMAGE_CHAT_CREATE ": / icons / png / add.png"
# define IMAGE_CHAT_OPEN ": / icons / png / typing.png"
2013-06-16 14:39:44 +00:00
# define IMAGE_CHAT_DELETE ": / images / deletemail24.png"
# define IMAGE_CHAT_COPY ": / images / copyrslink.png"
2010-09-07 23:19:27 +00:00
2017-03-02 22:30:51 +01:00
QString ChatPage : : loadStyleInfo ( ChatStyle : : enumStyleType type , QComboBox * style_CB , QComboBox * comboBox , QString & styleVariant )
2010-09-07 15:49:31 +00:00
{
QList < ChatStyleInfo > styles ;
QList < ChatStyleInfo > : : iterator style ;
2017-02-15 21:30:49 +01:00
int activeItem = 0 ;
2010-09-07 15:49:31 +00:00
QString stylePath ;
switch ( type ) {
case ChatStyle : : TYPE_PUBLIC :
2010-09-07 23:19:27 +00:00
Settings - > getPublicChatStyle ( stylePath , styleVariant ) ;
2010-09-07 15:49:31 +00:00
break ;
case ChatStyle : : TYPE_PRIVATE :
2010-09-07 23:19:27 +00:00
Settings - > getPrivateChatStyle ( stylePath , styleVariant ) ;
2010-09-07 15:49:31 +00:00
break ;
case ChatStyle : : TYPE_HISTORY :
2010-09-07 23:19:27 +00:00
Settings - > getHistoryChatStyle ( stylePath , styleVariant ) ;
2010-09-07 15:49:31 +00:00
break ;
case ChatStyle : : TYPE_UNKNOWN :
return " " ;
}
ChatStyle : : getAvailableStyles ( type , styles ) ;
2017-02-15 21:30:49 +01:00
while ( style_CB - > count ( ) )
2017-03-02 20:30:54 +01:00
whileBlocking ( style_CB ) - > removeItem ( 0 ) ;
2017-02-15 21:30:49 +01:00
int n = 0 ;
for ( style = styles . begin ( ) ; style ! = styles . end ( ) ; + + style , + + n )
{
2017-03-02 20:30:54 +01:00
whileBlocking ( style_CB ) - > insertItem ( n , style - > styleName ) ;
2017-02-15 21:30:49 +01:00
style_CB - > setItemData ( n , qVariantFromValue ( * style ) , Qt : : UserRole ) ;
2010-09-07 15:49:31 +00:00
if ( style - > stylePath = = stylePath ) {
2017-02-15 21:30:49 +01:00
activeItem = n ;
2010-09-07 15:49:31 +00:00
}
}
2017-03-02 20:30:54 +01:00
whileBlocking ( style_CB ) - > setCurrentIndex ( activeItem ) ;
2010-09-07 15:49:31 +00:00
2017-03-02 22:30:51 +01:00
switch ( type )
{
case ChatStyle : : TYPE_PUBLIC : on_publicList_currentRowChanged ( activeItem ) ; break ;
case ChatStyle : : TYPE_PRIVATE : on_privateList_currentRowChanged ( activeItem ) ; break ;
case ChatStyle : : TYPE_HISTORY : on_historyList_currentRowChanged ( activeItem ) ; break ;
default :
break ;
}
2010-09-07 23:19:27 +00:00
/* now the combobox should be filled */
int index = comboBox - > findText ( styleVariant ) ;
2017-03-02 20:30:54 +01:00
2010-09-07 23:19:27 +00:00
if ( index ! = - 1 ) {
2017-03-02 20:30:54 +01:00
whileBlocking ( comboBox ) - > setCurrentIndex ( index ) ;
2010-09-07 23:19:27 +00:00
} else {
if ( comboBox - > count ( ) ) {
2017-03-02 20:30:54 +01:00
whileBlocking ( comboBox ) - > setCurrentIndex ( 0 ) ;
2010-09-07 23:19:27 +00:00
}
}
2010-09-07 15:49:31 +00:00
return stylePath ;
}
2017-01-30 21:38:06 +01:00
void ChatPage : : updateFontsAndEmotes ( )
2010-05-03 21:17:36 +00:00
{
2010-09-04 14:23:30 +00:00
Settings - > beginGroup ( QString ( " Chat " ) ) ;
2012-09-21 21:23:14 +00:00
Settings - > setValue ( " Emoteicons_PrivatChat " , ui . checkBox_emoteprivchat - > isChecked ( ) ) ;
Settings - > setValue ( " Emoteicons_GroupChat " , ui . checkBox_emotegroupchat - > isChecked ( ) ) ;
Settings - > setValue ( " EnableCustomFonts " , ui . checkBox_enableCustomFonts - > isChecked ( ) ) ;
Settings - > setValue ( " EnableCustomFontSize " , ui . checkBox_enableCustomFontSize - > isChecked ( ) ) ;
2017-01-30 21:38:06 +01:00
Settings - > setValue ( " MinimumFontSize " , ui . minimumFontSize - > value ( ) ) ;
2012-09-21 21:23:14 +00:00
Settings - > setValue ( " EnableBold " , ui . checkBox_enableBold - > isChecked ( ) ) ;
Settings - > setValue ( " EnableItalics " , ui . checkBox_enableItalics - > isChecked ( ) ) ;
Settings - > setValue ( " MinimumContrast " , ui . minimumContrast - > value ( ) ) ;
2010-09-04 14:23:30 +00:00
Settings - > endGroup ( ) ;
2017-01-30 21:38:06 +01:00
}
/** Saves the changes on this page */
void ChatPage : : updateChatParams ( )
{
// state of distant Chat combobox
Settings - > setValue ( " DistantChat " , ui . distantChatComboBox - > currentIndex ( ) ) ;
Settings - > setChatScreenFont ( fontTempChat . toString ( ) ) ;
NotifyQt : : getInstance ( ) - > notifyChatFontChanged ( ) ;
Settings - > setChatSendMessageWithCtrlReturn ( ui . sendMessageWithCtrlReturn - > isChecked ( ) ) ;
Settings - > setChatSendAsPlainTextByDef ( ui . sendAsPlainTextByDef - > isChecked ( ) ) ;
Settings - > setChatLoadEmbeddedImages ( ui . loadEmbeddedImages - > isChecked ( ) ) ;
Settings - > setChatDoNotSendIsTyping ( ui . DontSendTyping - > isChecked ( ) ) ;
}
void ChatPage : : updateChatSearchParams ( )
{
Settings - > setChatSearchCharToStartSearch ( ui . sbSearch_CharToStart - > value ( ) ) ;
Settings - > setChatSearchCaseSensitively ( ui . cbSearch_CaseSensitively - > isChecked ( ) ) ;
Settings - > setChatSearchWholeWords ( ui . cbSearch_WholeWords - > isChecked ( ) ) ;
Settings - > setChatSearchMoveToCursor ( ui . cbSearch_MoveToCursor - > isChecked ( ) ) ;
Settings - > setChatSearchSearchWithoutLimit ( ui . cbSearch_WithoutLimit - > isChecked ( ) ) ;
Settings - > setChatSearchMaxSearchLimitColor ( ui . sbSearch_MaxLimitColor - > value ( ) ) ;
Settings - > setChatSearchFoundColor ( rgbChatSearchFoundColor ) ;
}
2010-11-04 11:14:47 +00:00
2017-01-30 21:38:06 +01:00
void ChatPage : : updateDefaultLobbyIdentity ( )
{
2015-03-06 21:13:23 +00:00
RsGxsId chosen_id ;
2017-01-30 21:38:06 +01:00
switch ( ui . chatLobbyIdentity_IC - > getChosenId ( chosen_id ) )
{
case GxsIdChooser : : KnowId :
case GxsIdChooser : : UnKnowId :
rsMsgs - > setDefaultIdentityForChatLobby ( chosen_id ) ;
break ;
default : ;
}
}
2011-12-26 22:43:54 +00:00
2010-09-07 15:49:31 +00:00
2017-01-30 21:38:06 +01:00
void ChatPage : : updateHistoryParams ( )
{
Settings - > setPublicChatHistoryCount ( ui . publicChatLoadCount - > value ( ) ) ;
Settings - > setPrivateChatHistoryCount ( ui . privateChatLoadCount - > value ( ) ) ;
Settings - > setLobbyChatHistoryCount ( ui . lobbyChatLoadCount - > value ( ) ) ;
2019-10-14 02:29:20 +02:00
Settings - > setDistantChatHistoryCount ( ui . distantChatLoadCount - > value ( ) ) ;
2010-09-07 15:49:31 +00:00
2017-01-30 21:38:06 +01:00
rsHistory - > setEnable ( RS_HISTORY_TYPE_PUBLIC , ui . publicChatEnable - > isChecked ( ) ) ;
rsHistory - > setEnable ( RS_HISTORY_TYPE_PRIVATE , ui . privateChatEnable - > isChecked ( ) ) ;
rsHistory - > setEnable ( RS_HISTORY_TYPE_LOBBY , ui . lobbyChatEnable - > isChecked ( ) ) ;
2019-10-14 02:29:20 +02:00
rsHistory - > setEnable ( RS_HISTORY_TYPE_DISTANT , ui . distantChatEnable - > isChecked ( ) ) ;
2017-01-30 21:38:06 +01:00
rsHistory - > setSaveCount ( RS_HISTORY_TYPE_PUBLIC , ui . publicChatSaveCount - > value ( ) ) ;
rsHistory - > setSaveCount ( RS_HISTORY_TYPE_PRIVATE , ui . privateChatSaveCount - > value ( ) ) ;
rsHistory - > setSaveCount ( RS_HISTORY_TYPE_LOBBY , ui . lobbyChatSaveCount - > value ( ) ) ;
2019-10-14 02:29:20 +02:00
rsHistory - > setSaveCount ( RS_HISTORY_TYPE_DISTANT , ui . distantChatSaveCount - > value ( ) ) ;
2017-01-30 21:38:06 +01:00
}
void ChatPage : : updatePublicStyle ( )
{
2017-02-15 21:30:49 +01:00
ChatStyleInfo info = ui . publicStyle - > itemData ( ui . historyStyle - > currentIndex ( ) , Qt : : UserRole ) . value < ChatStyleInfo > ( ) ;
if ( publicStylePath ! = info . stylePath | | publicStyleVariant ! = ui . publicComboBoxVariant - > currentText ( ) ) {
Settings - > setPublicChatStyle ( info . stylePath , ui . publicComboBoxVariant - > currentText ( ) ) ;
NotifyQt : : getInstance ( ) - > notifyChatStyleChanged ( ChatStyle : : TYPE_PUBLIC ) ;
2017-01-30 21:38:06 +01:00
}
}
void ChatPage : : updatePrivateStyle ( )
{
2017-02-15 21:30:49 +01:00
ChatStyleInfo info = ui . privateStyle - > itemData ( ui . historyStyle - > currentIndex ( ) , Qt : : UserRole ) . value < ChatStyleInfo > ( ) ;
if ( privateStylePath ! = info . stylePath | | privateStyleVariant ! = ui . privateComboBoxVariant - > currentText ( ) ) {
Settings - > setPrivateChatStyle ( info . stylePath , ui . privateComboBoxVariant - > currentText ( ) ) ;
NotifyQt : : getInstance ( ) - > notifyChatStyleChanged ( ChatStyle : : TYPE_PRIVATE ) ;
2017-01-30 21:38:06 +01:00
}
}
2010-09-07 15:49:31 +00:00
2017-01-30 21:38:06 +01:00
void ChatPage : : updateHistoryStyle ( )
{
2017-02-15 21:30:49 +01:00
ChatStyleInfo info = ui . historyStyle - > itemData ( ui . historyStyle - > currentIndex ( ) , Qt : : UserRole ) . value < ChatStyleInfo > ( ) ;
if ( historyStylePath ! = info . stylePath | | historyStyleVariant ! = ui . historyComboBoxVariant - > currentText ( ) ) {
Settings - > setHistoryChatStyle ( info . stylePath , ui . historyComboBoxVariant - > currentText ( ) ) ;
NotifyQt : : getInstance ( ) - > notifyChatStyleChanged ( ChatStyle : : TYPE_HISTORY ) ;
2017-01-30 21:38:06 +01:00
}
}
2013-09-27 21:18:44 +00:00
2017-01-30 21:38:06 +01:00
void ChatPage : : updateHistoryStorage ( ) { rsHistory - > setMaxStorageDuration ( ui . max_storage_period - > value ( ) * 86400 ) ; }
2012-10-27 15:51:34 +00:00
2017-01-30 21:38:06 +01:00
/** Constructor */
ChatPage : : ChatPage ( QWidget * parent , Qt : : WindowFlags flags )
: ConfigPage ( parent , flags )
{
/* Invoke the Qt Designer generated object setup routine */
ui . setupUi ( this ) ;
2012-10-27 15:51:34 +00:00
2017-01-30 21:38:06 +01:00
# if QT_VERSION < 0x040600
ui . minimumContrastLabel - > hide ( ) ;
ui . minimumContrast - > hide ( ) ;
# endif
connect ( ui . distantChatComboBox , SIGNAL ( currentIndexChanged ( int ) ) , this , SLOT ( distantChatComboBoxChanged ( int ) ) ) ;
connect ( ui . checkBox_emoteprivchat , SIGNAL ( toggled ( bool ) ) , this , SLOT ( updateFontsAndEmotes ( ) ) ) ;
connect ( ui . checkBox_emotegroupchat , SIGNAL ( toggled ( bool ) ) , this , SLOT ( updateFontsAndEmotes ( ) ) ) ;
connect ( ui . checkBox_enableCustomFonts , SIGNAL ( toggled ( bool ) ) , this , SLOT ( updateFontsAndEmotes ( ) ) ) ;
connect ( ui . minimumFontSize , SIGNAL ( valueChanged ( int ) ) , this , SLOT ( updateFontsAndEmotes ( ) ) ) ;
connect ( ui . checkBox_enableBold , SIGNAL ( toggled ( bool ) ) , this , SLOT ( updateFontsAndEmotes ( ) ) ) ;
connect ( ui . checkBox_enableItalics , SIGNAL ( toggled ( bool ) ) , this , SLOT ( updateFontsAndEmotes ( ) ) ) ;
connect ( ui . minimumContrast , SIGNAL ( valueChanged ( int ) ) , this , SLOT ( updateFontsAndEmotes ( ) ) ) ;
connect ( ui . distantChatComboBox , SIGNAL ( currentIndexChanged ( int ) ) , this , SLOT ( updateChatParams ( ) ) ) ;
connect ( ui . sendMessageWithCtrlReturn , SIGNAL ( toggled ( bool ) ) , this , SLOT ( updateChatParams ( ) ) ) ;
connect ( ui . sendAsPlainTextByDef , SIGNAL ( toggled ( bool ) ) , this , SLOT ( updateChatParams ( ) ) ) ;
connect ( ui . loadEmbeddedImages , SIGNAL ( toggled ( bool ) ) , this , SLOT ( updateChatParams ( ) ) ) ;
connect ( ui . DontSendTyping , SIGNAL ( toggled ( bool ) ) , this , SLOT ( updateChatParams ( ) ) ) ;
connect ( ui . sbSearch_CharToStart , SIGNAL ( valueChanged ( int ) ) , this , SLOT ( updateChatSearchParams ( ) ) ) ;
connect ( ui . cbSearch_CaseSensitively , SIGNAL ( toggled ( bool ) ) , this , SLOT ( updateChatSearchParams ( ) ) ) ;
connect ( ui . cbSearch_WholeWords , SIGNAL ( toggled ( bool ) ) , this , SLOT ( updateChatSearchParams ( ) ) ) ;
connect ( ui . cbSearch_MoveToCursor , SIGNAL ( toggled ( bool ) ) , this , SLOT ( updateChatSearchParams ( ) ) ) ;
connect ( ui . cbSearch_WithoutLimit , SIGNAL ( toggled ( bool ) ) , this , SLOT ( updateChatSearchParams ( ) ) ) ;
connect ( ui . sbSearch_MaxLimitColor , SIGNAL ( valueChanged ( int ) ) , this , SLOT ( updateChatSearchParams ( ) ) ) ;
connect ( ui . chatLobbyIdentity_IC , SIGNAL ( currentIndexChanged ( int ) ) , this , SLOT ( updateDefaultLobbyIdentity ( ) ) ) ;
connect ( ui . publicChatLoadCount , SIGNAL ( valueChanged ( int ) ) , this , SLOT ( updateHistoryParams ( ) ) ) ;
connect ( ui . privateChatLoadCount , SIGNAL ( valueChanged ( int ) ) , this , SLOT ( updateHistoryParams ( ) ) ) ;
2019-10-14 02:29:20 +02:00
connect ( ui . distantChatLoadCount , SIGNAL ( valueChanged ( int ) ) , this , SLOT ( updateHistoryParams ( ) ) ) ;
2017-01-30 21:38:06 +01:00
connect ( ui . lobbyChatLoadCount , SIGNAL ( valueChanged ( int ) ) , this , SLOT ( updateHistoryParams ( ) ) ) ;
2019-10-14 02:29:20 +02:00
2017-01-30 21:38:06 +01:00
connect ( ui . publicChatEnable , SIGNAL ( toggled ( bool ) ) , this , SLOT ( updateHistoryParams ( ) ) ) ;
connect ( ui . privateChatEnable , SIGNAL ( toggled ( bool ) ) , this , SLOT ( updateHistoryParams ( ) ) ) ;
2019-10-14 02:29:20 +02:00
connect ( ui . distantChatEnable , SIGNAL ( toggled ( bool ) ) , this , SLOT ( updateHistoryParams ( ) ) ) ;
2017-01-30 21:38:06 +01:00
connect ( ui . lobbyChatEnable , SIGNAL ( toggled ( bool ) ) , this , SLOT ( updateHistoryParams ( ) ) ) ;
2019-10-14 02:29:20 +02:00
2017-01-30 21:38:06 +01:00
connect ( ui . publicChatSaveCount , SIGNAL ( valueChanged ( int ) ) , this , SLOT ( updateHistoryParams ( ) ) ) ;
connect ( ui . privateChatSaveCount , SIGNAL ( valueChanged ( int ) ) , this , SLOT ( updateHistoryParams ( ) ) ) ;
connect ( ui . lobbyChatSaveCount , SIGNAL ( valueChanged ( int ) ) , this , SLOT ( updateHistoryParams ( ) ) ) ;
2019-10-14 02:29:20 +02:00
connect ( ui . distantChatSaveCount , SIGNAL ( valueChanged ( int ) ) , this , SLOT ( updateHistoryParams ( ) ) ) ;
2017-01-30 21:38:06 +01:00
2017-02-15 21:30:49 +01:00
connect ( ui . publicStyle , SIGNAL ( currentIndexChanged ( int ) ) , this , SLOT ( updatePublicStyle ( ) ) ) ;
2017-01-30 21:38:06 +01:00
connect ( ui . publicComboBoxVariant , SIGNAL ( currentIndexChanged ( int ) ) , this , SLOT ( updatePublicStyle ( ) ) ) ;
2017-02-15 21:30:49 +01:00
connect ( ui . privateStyle , SIGNAL ( currentIndexChanged ( int ) ) , this , SLOT ( updatePrivateStyle ( ) ) ) ;
2017-01-30 21:38:06 +01:00
connect ( ui . privateComboBoxVariant , SIGNAL ( currentIndexChanged ( int ) ) , this , SLOT ( updatePrivateStyle ( ) ) ) ;
2017-02-15 21:30:49 +01:00
connect ( ui . historyStyle , SIGNAL ( currentIndexChanged ( int ) ) , this , SLOT ( updateHistoryStyle ( ) ) ) ;
2017-01-30 21:38:06 +01:00
connect ( ui . historyComboBoxVariant , SIGNAL ( currentIndexChanged ( int ) ) , this , SLOT ( updateHistoryStyle ( ) ) ) ;
connect ( ui . max_storage_period , SIGNAL ( valueChanged ( int ) ) , this , SLOT ( updateHistoryStorage ( ) ) ) ;
connect ( ui . chat_NewWindow , SIGNAL ( toggled ( bool ) ) , this , SLOT ( updateChatFlags ( ) ) ) ;
connect ( ui . chat_Focus , SIGNAL ( toggled ( bool ) ) , this , SLOT ( updateChatFlags ( ) ) ) ;
connect ( ui . chat_tabbedWindow , SIGNAL ( toggled ( bool ) ) , this , SLOT ( updateChatFlags ( ) ) ) ;
connect ( ui . chat_Blink , SIGNAL ( toggled ( bool ) ) , this , SLOT ( updateChatFlags ( ) ) ) ;
connect ( ui . chatLobby_Blink , SIGNAL ( toggled ( bool ) ) , this , SLOT ( updateChatLobbyFlags ( ) ) ) ;
2017-02-15 21:30:49 +01:00
connect ( ui . publicStyle , SIGNAL ( currentIndexChanged ( int ) ) , this , SLOT ( on_publicList_currentRowChanged ( int ) ) ) ;
connect ( ui . privateStyle , SIGNAL ( currentIndexChanged ( int ) ) , this , SLOT ( on_privateList_currentRowChanged ( int ) ) ) ;
connect ( ui . historyStyle , SIGNAL ( currentIndexChanged ( int ) ) , this , SLOT ( on_historyList_currentRowChanged ( int ) ) ) ;
2017-01-30 21:38:06 +01:00
}
void ChatPage : : updateChatFlags ( )
{
uint chatflags = 0 ;
if ( ui . chat_NewWindow - > isChecked ( ) )
chatflags | = RS_CHAT_OPEN ;
if ( ui . chat_Focus - > isChecked ( ) )
chatflags | = RS_CHAT_FOCUS ;
if ( ui . chat_tabbedWindow - > isChecked ( ) )
chatflags | = RS_CHAT_TABBED_WINDOW ;
if ( ui . chat_Blink - > isChecked ( ) )
chatflags | = RS_CHAT_BLINK ;
Settings - > setChatFlags ( chatflags ) ;
}
2012-10-27 15:59:12 +00:00
2017-01-30 21:38:06 +01:00
void ChatPage : : updateChatLobbyFlags ( )
{
uint chatLobbyFlags = 0 ;
2012-10-27 15:59:12 +00:00
2017-01-30 21:38:06 +01:00
if ( ui . chatLobby_Blink - > isChecked ( ) )
chatLobbyFlags | = RS_CHATLOBBY_BLINK ;
2012-10-27 15:59:12 +00:00
2017-01-30 21:38:06 +01:00
Settings - > setChatLobbyFlags ( chatLobbyFlags ) ;
2010-05-03 21:17:36 +00:00
}
/** Loads the settings for this page */
void
ChatPage : : load ( )
{
2010-09-04 14:23:30 +00:00
Settings - > beginGroup ( QString ( " Chat " ) ) ;
2017-02-27 23:13:45 +01:00
whileBlocking ( ui . checkBox_emoteprivchat ) - > setChecked ( Settings - > value ( " Emoteicons_PrivatChat " , true ) . toBool ( ) ) ;
whileBlocking ( ui . checkBox_emotegroupchat ) - > setChecked ( Settings - > value ( " Emoteicons_GroupChat " , true ) . toBool ( ) ) ;
whileBlocking ( ui . checkBox_enableCustomFonts ) - > setChecked ( Settings - > value ( " EnableCustomFonts " , true ) . toBool ( ) ) ;
whileBlocking ( ui . checkBox_enableCustomFontSize ) - > setChecked ( Settings - > value ( " EnableCustomFontSize " , true ) . toBool ( ) ) ;
whileBlocking ( ui . minimumFontSize ) - > setValue ( Settings - > value ( " MinimumFontSize " , 10 ) . toInt ( ) ) ;
whileBlocking ( ui . checkBox_enableBold ) - > setChecked ( Settings - > value ( " EnableBold " , true ) . toBool ( ) ) ;
whileBlocking ( ui . checkBox_enableItalics ) - > setChecked ( Settings - > value ( " EnableItalics " , true ) . toBool ( ) ) ;
whileBlocking ( ui . minimumContrast ) - > setValue ( Settings - > value ( " MinimumContrast " , 4.5 ) . toDouble ( ) ) ;
2010-09-04 14:23:30 +00:00
Settings - > endGroup ( ) ;
2010-05-03 21:17:36 +00:00
2015-12-05 16:49:00 -05:00
// state of distant Chat combobox
int index = Settings - > value ( " DistantChat " , 0 ) . toInt ( ) ;
2017-02-27 23:13:45 +01:00
whileBlocking ( ui . distantChatComboBox ) - > setCurrentIndex ( index ) ;
2015-12-05 16:49:00 -05:00
2010-09-10 18:38:46 +00:00
fontTempChat . fromString ( Settings - > getChatScreenFont ( ) ) ;
2017-02-27 23:13:45 +01:00
whileBlocking ( ui . sendMessageWithCtrlReturn ) - > setChecked ( Settings - > getChatSendMessageWithCtrlReturn ( ) ) ;
whileBlocking ( ui . sendAsPlainTextByDef ) - > setChecked ( Settings - > getChatSendAsPlainTextByDef ( ) ) ;
whileBlocking ( ui . loadEmbeddedImages ) - > setChecked ( Settings - > getChatLoadEmbeddedImages ( ) ) ;
whileBlocking ( ui . DontSendTyping ) - > setChecked ( Settings - > getChatDoNotSendIsTyping ( ) ) ;
2010-05-03 21:17:36 +00:00
2017-01-23 00:25:17 +03:00
std : : string advsetting ;
if ( rsConfig - > getConfigurationOption ( RS_CONFIG_ADVANCED , advsetting ) & & ( advsetting = = " YES " ) )
{ }
else
ui . DontSendTyping - > hide ( ) ;
2017-02-27 23:13:45 +01:00
whileBlocking ( ui . sbSearch_CharToStart ) - > setValue ( Settings - > getChatSearchCharToStartSearch ( ) ) ;
whileBlocking ( ui . cbSearch_CaseSensitively ) - > setChecked ( Settings - > getChatSearchCaseSensitively ( ) ) ;
whileBlocking ( ui . cbSearch_WholeWords ) - > setChecked ( Settings - > getChatSearchWholeWords ( ) ) ;
whileBlocking ( ui . cbSearch_MoveToCursor ) - > setChecked ( Settings - > getChatSearchMoveToCursor ( ) ) ;
whileBlocking ( ui . cbSearch_WithoutLimit ) - > setChecked ( Settings - > getChatSearchSearchWithoutLimit ( ) ) ;
whileBlocking ( ui . sbSearch_MaxLimitColor ) - > setValue ( Settings - > getChatSearchMaxSearchLimitColor ( ) ) ;
2014-05-26 21:51:53 +00:00
rgbChatSearchFoundColor = Settings - > getChatSearchFoundColor ( ) ;
QPixmap pix ( 24 , 24 ) ;
pix . fill ( rgbChatSearchFoundColor ) ;
ui . btSearch_FoundColor - > setIcon ( pix ) ;
2017-02-27 23:13:45 +01:00
whileBlocking ( ui . publicChatLoadCount ) - > setValue ( Settings - > getPublicChatHistoryCount ( ) ) ;
whileBlocking ( ui . privateChatLoadCount ) - > setValue ( Settings - > getPrivateChatHistoryCount ( ) ) ;
whileBlocking ( ui . lobbyChatLoadCount ) - > setValue ( Settings - > getLobbyChatHistoryCount ( ) ) ;
2019-10-14 02:29:20 +02:00
whileBlocking ( ui . distantChatLoadCount ) - > setValue ( Settings - > getDistantChatHistoryCount ( ) ) ;
2011-09-29 09:20:09 +00:00
2017-02-27 23:13:45 +01:00
whileBlocking ( ui . publicChatEnable ) - > setChecked ( rsHistory - > getEnable ( RS_HISTORY_TYPE_PUBLIC ) ) ;
whileBlocking ( ui . privateChatEnable ) - > setChecked ( rsHistory - > getEnable ( RS_HISTORY_TYPE_PRIVATE ) ) ;
whileBlocking ( ui . lobbyChatEnable ) - > setChecked ( rsHistory - > getEnable ( RS_HISTORY_TYPE_LOBBY ) ) ;
2019-10-14 02:29:20 +02:00
whileBlocking ( ui . distantChatEnable ) - > setChecked ( rsHistory - > getEnable ( RS_HISTORY_TYPE_DISTANT ) ) ;
2011-09-29 09:20:09 +00:00
2017-02-27 23:13:45 +01:00
whileBlocking ( ui . publicChatSaveCount ) - > setValue ( rsHistory - > getSaveCount ( RS_HISTORY_TYPE_PUBLIC ) ) ;
whileBlocking ( ui . privateChatSaveCount ) - > setValue ( rsHistory - > getSaveCount ( RS_HISTORY_TYPE_PRIVATE ) ) ;
whileBlocking ( ui . lobbyChatSaveCount ) - > setValue ( rsHistory - > getSaveCount ( RS_HISTORY_TYPE_LOBBY ) ) ;
2019-10-14 02:29:20 +02:00
whileBlocking ( ui . distantChatSaveCount ) - > setValue ( rsHistory - > getSaveCount ( RS_HISTORY_TYPE_DISTANT ) ) ;
2015-01-08 19:12:47 +00:00
// using fontTempChat.rawname() does not always work!
// see http://doc.qt.digia.com/qt-maemo/qfont.html#rawName
QStringList fontname = fontTempChat . toString ( ) . split ( " , " ) ;
2017-02-27 23:13:45 +01:00
whileBlocking ( ui . labelChatFontPreview ) - > setText ( fontname [ 0 ] ) ;
whileBlocking ( ui . labelChatFontPreview ) - > setFont ( fontTempChat ) ;
2010-09-07 15:49:31 +00:00
2017-03-02 20:30:54 +01:00
whileBlocking ( ui . max_storage_period ) - > setValue ( rsHistory - > getMaxStorageDuration ( ) / 86400 ) ;
2013-09-27 21:18:44 +00:00
2010-09-07 15:49:31 +00:00
/* Load styles */
2017-02-15 21:30:49 +01:00
publicStylePath = loadStyleInfo ( ChatStyle : : TYPE_PUBLIC , ui . publicStyle , ui . publicComboBoxVariant , publicStyleVariant ) ;
privateStylePath = loadStyleInfo ( ChatStyle : : TYPE_PRIVATE , ui . privateStyle , ui . privateComboBoxVariant , privateStyleVariant ) ;
historyStylePath = loadStyleInfo ( ChatStyle : : TYPE_HISTORY , ui . historyStyle , ui . historyComboBoxVariant , historyStyleVariant ) ;
2011-12-26 22:43:54 +00:00
2015-03-06 21:13:23 +00:00
RsGxsId gxs_id ;
rsMsgs - > getDefaultIdentityForChatLobby ( gxs_id ) ;
2015-03-26 21:20:57 +00:00
ui . chatLobbyIdentity_IC - > setFlags ( IDCHOOSER_ID_REQUIRED ) ;
if ( ! gxs_id . isNull ( ) )
ui . chatLobbyIdentity_IC - > setChosenId ( gxs_id ) ;
2012-10-27 15:51:34 +00:00
uint chatflags = Settings - > getChatFlags ( ) ;
2017-02-27 23:13:45 +01:00
whileBlocking ( ui . chat_NewWindow ) - > setChecked ( chatflags & RS_CHAT_OPEN ) ;
whileBlocking ( ui . chat_Focus ) - > setChecked ( chatflags & RS_CHAT_FOCUS ) ;
whileBlocking ( ui . chat_tabbedWindow ) - > setChecked ( chatflags & RS_CHAT_TABBED_WINDOW ) ;
whileBlocking ( ui . chat_Blink ) - > setChecked ( chatflags & RS_CHAT_BLINK ) ;
2012-10-27 15:59:12 +00:00
uint chatLobbyFlags = Settings - > getChatLobbyFlags ( ) ;
2017-02-27 23:13:45 +01:00
whileBlocking ( ui . chatLobby_Blink ) - > setChecked ( chatLobbyFlags & RS_CHATLOBBY_BLINK ) ;
2013-06-16 14:39:44 +00:00
// load personal invites
//
2014-05-25 21:43:05 +00:00
# ifdef TO_BE_DONE
2017-07-21 15:11:55 +02:00
for ( ; ; )
2014-05-25 21:43:05 +00:00
{
QListWidgetItem * item = new QListWidgetItem ;
2015-06-12 08:27:26 +00:00
item - > setData ( Qt : : DisplayRole , tr ( " Private chat invite from " ) + " " + QString : : fromUtf8 ( detail . name . c_str ( ) ) ) ;
2014-05-25 21:43:05 +00:00
QString tt ;
2015-06-12 08:27:26 +00:00
tt + = tr ( " Name : " ) + " " + QString : : fromUtf8 ( detail . name . c_str ( ) ) ;
tt + = " \n " + tr ( " PGP id : " ) + " " + QString : : fromStdString ( invites [ i ] . destination_pgp_id . toStdString ( ) ) ;
tt + = " \n " + tr ( " Valid until : " ) + " " + QDateTime : : fromTime_t ( invites [ i ] . time_of_validity ) . toString ( ) ;
2014-05-25 21:43:05 +00:00
item - > setData ( Qt : : UserRole , QString : : fromStdString ( invites [ i ] . pid . toStdString ( ) ) ) ;
item - > setToolTip ( tt ) ;
ui . _collected_contacts_LW - > insertItem ( 0 , item ) ;
}
# endif
2010-05-03 21:17:36 +00:00
}
2010-05-14 12:42:31 +00:00
void ChatPage : : on_pushButtonChangeChatFont_clicked ( )
{
bool ok ;
2018-12-31 18:34:48 +01:00
QFont font = misc : : getFont ( & ok , fontTempChat , this , tr ( " Choose your default font for Chat. " ) ) ;
2010-05-14 12:42:31 +00:00
if ( ok ) {
fontTempChat = font ;
2015-01-08 19:12:47 +00:00
// using fontTempChat.rawname() does not always work!
// see http://doc.qt.digia.com/qt-maemo/qfont.html#rawName
QStringList fontname = fontTempChat . toString ( ) . split ( " , " ) ;
ui . labelChatFontPreview - > setText ( fontname [ 0 ] ) ;
2010-05-14 12:42:31 +00:00
ui . labelChatFontPreview - > setFont ( fontTempChat ) ;
2017-05-19 18:40:17 +02:00
updateChatParams ( ) ;
2010-05-14 12:42:31 +00:00
}
}
2010-09-07 15:49:31 +00:00
2010-09-07 23:19:27 +00:00
void ChatPage : : setPreviewMessages ( QString & stylePath , QString styleVariant , QTextBrowser * textBrowser )
2010-09-07 15:49:31 +00:00
{
ChatStyle style ;
2010-09-07 23:19:27 +00:00
style . setStylePath ( stylePath , styleVariant ) ;
2010-09-07 15:49:31 +00:00
textBrowser - > clear ( ) ;
2012-01-31 00:06:24 +00:00
QString nameIncoming = tr ( " Incoming " ) ;
QString nameOutgoing = tr ( " Outgoing " ) ;
2010-09-07 15:49:31 +00:00
QDateTime timestmp = QDateTime : : fromTime_t ( time ( NULL ) ) ;
2016-03-12 13:25:10 +01:00
QColor backgroundColor = textBrowser - > palette ( ) . base ( ) . color ( ) ;
textBrowser - > append ( style . formatMessage ( ChatStyle : : FORMATMSG_HINCOMING , nameIncoming , timestmp , tr ( " Incoming message in history " ) , 0 , backgroundColor ) ) ;
textBrowser - > append ( style . formatMessage ( ChatStyle : : FORMATMSG_HOUTGOING , nameOutgoing , timestmp , tr ( " Outgoing message in history " ) , 0 , backgroundColor ) ) ;
textBrowser - > append ( style . formatMessage ( ChatStyle : : FORMATMSG_INCOMING , nameIncoming , timestmp , tr ( " Incoming message " ) , 0 , backgroundColor ) ) ;
textBrowser - > append ( style . formatMessage ( ChatStyle : : FORMATMSG_OUTGOING , nameOutgoing , timestmp , tr ( " Outgoing message " ) , 0 , backgroundColor ) ) ;
textBrowser - > append ( style . formatMessage ( ChatStyle : : FORMATMSG_OOUTGOING , nameOutgoing , timestmp , tr ( " Outgoing offline message " ) , 0 , backgroundColor ) ) ;
textBrowser - > append ( style . formatMessage ( ChatStyle : : FORMATMSG_SYSTEM , tr ( " System " ) , timestmp , tr ( " System message " ) , 0 , backgroundColor ) ) ;
textBrowser - > append ( style . formatMessage ( ChatStyle : : FORMATMSG_OUTGOING , tr ( " UserName " ) , timestmp , tr ( " /me is sending a message with /me " ) , 0 , backgroundColor ) ) ;
2010-09-07 15:49:31 +00:00
}
2017-02-15 21:30:49 +01:00
void ChatPage : : fillPreview ( QComboBox * listWidget , QComboBox * comboBox , QTextBrowser * textBrowser )
2010-09-07 23:19:27 +00:00
{
2017-02-15 21:30:49 +01:00
ChatStyleInfo info = listWidget - > itemData ( listWidget - > currentIndex ( ) , Qt : : UserRole ) . value < ChatStyleInfo > ( ) ;
2010-09-07 23:19:27 +00:00
2017-02-15 21:30:49 +01:00
setPreviewMessages ( info . stylePath , comboBox - > currentText ( ) , textBrowser ) ;
2010-09-07 23:19:27 +00:00
}
2010-09-07 15:49:31 +00:00
void ChatPage : : on_publicList_currentRowChanged ( int currentRow )
{
if ( currentRow ! = - 1 ) {
2017-02-15 21:30:49 +01:00
ChatStyleInfo info = ui . publicStyle - > itemData ( currentRow , Qt : : UserRole ) . value < ChatStyleInfo > ( ) ;
2010-09-07 15:49:31 +00:00
QString author = info . authorName ;
if ( info . authorEmail . isEmpty ( ) = = false ) {
author + = " ( " + info . authorEmail + " ) " ;
}
ui . publicAuthor - > setText ( author ) ;
ui . publicDescription - > setText ( info . styleDescription ) ;
2010-09-07 23:19:27 +00:00
QStringList variants ;
ChatStyle : : getAvailableVariants ( info . stylePath , variants ) ;
2017-03-01 22:54:25 +01:00
whileBlocking ( ui . publicComboBoxVariant ) - > clear ( ) ;
whileBlocking ( ui . publicComboBoxVariant ) - > setEnabled ( variants . size ( ) ! = 0 ) ;
whileBlocking ( ui . publicComboBoxVariant ) - > addItems ( variants ) ;
2010-09-07 23:19:27 +00:00
/* try to find "Standard" */
int index = ui . publicComboBoxVariant - > findText ( VARIANT_STANDARD ) ;
if ( index ! = - 1 ) {
2017-03-01 22:54:25 +01:00
whileBlocking ( ui . publicComboBoxVariant ) - > setCurrentIndex ( index ) ;
2010-09-07 23:19:27 +00:00
} else {
2017-03-01 22:54:25 +01:00
whileBlocking ( ui . publicComboBoxVariant ) - > setCurrentIndex ( 0 ) ;
2010-09-07 23:19:27 +00:00
}
2010-09-07 15:49:31 +00:00
} else {
2017-03-01 22:54:25 +01:00
whileBlocking ( ui . publicAuthor ) - > clear ( ) ;
whileBlocking ( ui . publicDescription ) - > clear ( ) ;
whileBlocking ( ui . publicComboBoxVariant ) - > clear ( ) ;
whileBlocking ( ui . publicComboBoxVariant ) - > setDisabled ( true ) ;
2010-09-07 15:49:31 +00:00
}
2010-09-07 23:19:27 +00:00
2017-02-15 21:30:49 +01:00
fillPreview ( ui . publicStyle , ui . publicComboBoxVariant , ui . publicPreview ) ;
2010-09-07 15:49:31 +00:00
}
void ChatPage : : on_privateList_currentRowChanged ( int currentRow )
{
if ( currentRow ! = - 1 ) {
2017-02-15 21:30:49 +01:00
ChatStyleInfo info = ui . privateStyle - > itemData ( ui . privateStyle - > currentIndex ( ) , Qt : : UserRole ) . value < ChatStyleInfo > ( ) ;
2010-09-07 15:49:31 +00:00
QString author = info . authorName ;
if ( info . authorEmail . isEmpty ( ) = = false ) {
author + = " ( " + info . authorEmail + " ) " ;
}
2017-03-01 22:54:25 +01:00
whileBlocking ( ui . privateAuthor ) - > setText ( author ) ;
whileBlocking ( ui . privateDescription ) - > setText ( info . styleDescription ) ;
2010-09-07 23:19:27 +00:00
QStringList variants ;
ChatStyle : : getAvailableVariants ( info . stylePath , variants ) ;
2017-03-01 22:54:25 +01:00
whileBlocking ( ui . privateComboBoxVariant ) - > clear ( ) ;
whileBlocking ( ui . privateComboBoxVariant ) - > setEnabled ( variants . size ( ) ! = 0 ) ;
whileBlocking ( ui . privateComboBoxVariant ) - > addItems ( variants ) ;
2010-09-07 23:19:27 +00:00
/* try to find "Standard" */
int index = ui . privateComboBoxVariant - > findText ( VARIANT_STANDARD ) ;
if ( index ! = - 1 ) {
2017-03-01 22:54:25 +01:00
whileBlocking ( ui . privateComboBoxVariant ) - > setCurrentIndex ( index ) ;
2010-09-07 23:19:27 +00:00
} else {
2017-03-01 22:54:25 +01:00
whileBlocking ( ui . privateComboBoxVariant ) - > setCurrentIndex ( 0 ) ;
2010-09-07 23:19:27 +00:00
}
2010-09-07 15:49:31 +00:00
} else {
2017-03-01 22:54:25 +01:00
whileBlocking ( ui . privateAuthor ) - > clear ( ) ;
whileBlocking ( ui . privateDescription ) - > clear ( ) ;
whileBlocking ( ui . privateComboBoxVariant ) - > clear ( ) ;
whileBlocking ( ui . privateComboBoxVariant ) - > setDisabled ( true ) ;
2010-09-07 15:49:31 +00:00
}
2010-09-07 23:19:27 +00:00
2017-02-15 21:30:49 +01:00
fillPreview ( ui . privateStyle , ui . privateComboBoxVariant , ui . privatePreview ) ;
2010-09-07 15:49:31 +00:00
}
void ChatPage : : on_historyList_currentRowChanged ( int currentRow )
{
if ( currentRow ! = - 1 ) {
2017-02-15 21:30:49 +01:00
ChatStyleInfo info = ui . historyStyle - > itemData ( ui . historyStyle - > currentIndex ( ) , Qt : : UserRole ) . value < ChatStyleInfo > ( ) ;
2010-09-07 15:49:31 +00:00
QString author = info . authorName ;
if ( info . authorEmail . isEmpty ( ) = = false ) {
author + = " ( " + info . authorEmail + " ) " ;
}
2017-03-01 22:54:25 +01:00
whileBlocking ( ui . historyAuthor ) - > setText ( author ) ;
whileBlocking ( ui . historyDescription ) - > setText ( info . styleDescription ) ;
2010-09-07 23:19:27 +00:00
QStringList variants ;
ChatStyle : : getAvailableVariants ( info . stylePath , variants ) ;
2017-03-01 22:54:25 +01:00
whileBlocking ( ui . historyComboBoxVariant ) - > clear ( ) ;
whileBlocking ( ui . historyComboBoxVariant ) - > setEnabled ( variants . size ( ) ! = 0 ) ;
whileBlocking ( ui . historyComboBoxVariant ) - > addItems ( variants ) ;
2010-09-07 23:19:27 +00:00
/* try to find "Standard" */
int index = ui . historyComboBoxVariant - > findText ( VARIANT_STANDARD ) ;
if ( index ! = - 1 ) {
2017-03-01 22:54:25 +01:00
whileBlocking ( ui . historyComboBoxVariant ) - > setCurrentIndex ( index ) ;
2010-09-07 23:19:27 +00:00
} else {
2017-03-01 22:54:25 +01:00
whileBlocking ( ui . historyComboBoxVariant ) - > setCurrentIndex ( 0 ) ;
2010-09-07 23:19:27 +00:00
}
2010-09-07 15:49:31 +00:00
} else {
2017-03-01 22:54:25 +01:00
whileBlocking ( ui . historyAuthor ) - > clear ( ) ;
whileBlocking ( ui . historyDescription ) - > clear ( ) ;
whileBlocking ( ui . historyComboBoxVariant ) - > clear ( ) ;
whileBlocking ( ui . historyComboBoxVariant ) - > setDisabled ( true ) ;
2010-09-07 15:49:31 +00:00
}
2010-09-07 23:19:27 +00:00
2017-02-15 21:30:49 +01:00
fillPreview ( ui . historyStyle , ui . historyComboBoxVariant , ui . historyPreview ) ;
2010-09-07 23:19:27 +00:00
}
2011-08-12 14:06:29 +00:00
void ChatPage : : on_publicComboBoxVariant_currentIndexChanged ( int /*index*/ )
2010-09-07 23:19:27 +00:00
{
2017-02-15 21:30:49 +01:00
fillPreview ( ui . publicStyle , ui . publicComboBoxVariant , ui . publicPreview ) ;
2010-09-07 23:19:27 +00:00
}
2011-08-12 14:06:29 +00:00
void ChatPage : : on_privateComboBoxVariant_currentIndexChanged ( int /*index*/ )
2010-09-07 23:19:27 +00:00
{
2017-02-15 21:30:49 +01:00
fillPreview ( ui . privateStyle , ui . privateComboBoxVariant , ui . privatePreview ) ;
2010-09-07 23:19:27 +00:00
}
2011-08-12 14:06:29 +00:00
void ChatPage : : on_historyComboBoxVariant_currentIndexChanged ( int /*index*/ )
2010-09-07 23:19:27 +00:00
{
2017-02-15 21:30:49 +01:00
fillPreview ( ui . historyStyle , ui . historyComboBoxVariant , ui . historyPreview ) ;
2010-09-07 15:49:31 +00:00
}
2014-05-26 21:51:53 +00:00
void ChatPage : : on_cbSearch_WithoutLimit_toggled ( bool checked )
{
ui . sbSearch_MaxLimitColor - > setEnabled ( ! checked ) ;
ui . lSearch_MaxLimitColor - > setEnabled ( ! checked ) ;
}
void ChatPage : : on_btSearch_FoundColor_clicked ( )
{
bool ok ;
QRgb color = QColorDialog : : getRgba ( rgbChatSearchFoundColor , & ok , window ( ) ) ;
if ( ok ) {
rgbChatSearchFoundColor = color ;
QPixmap pix ( 24 , 24 ) ;
pix . fill ( color ) ;
ui . btSearch_FoundColor - > setIcon ( pix ) ;
}
}
2015-12-05 16:49:00 -05:00
void ChatPage : : distantChatComboBoxChanged ( int i )
{
switch ( i )
{
2015-12-27 21:10:20 -05:00
default :
case 0 : rsMsgs - > setDistantChatPermissionFlags ( RS_DISTANT_CHAT_CONTACT_PERMISSION_FLAG_FILTER_NONE ) ;
2015-12-05 16:49:00 -05:00
break ;
2015-12-27 21:10:20 -05:00
case 1 : rsMsgs - > setDistantChatPermissionFlags ( RS_DISTANT_CHAT_CONTACT_PERMISSION_FLAG_FILTER_NON_CONTACTS ) ;
2015-12-05 16:49:00 -05:00
break ;
2015-12-27 21:10:20 -05:00
case 2 : rsMsgs - > setDistantChatPermissionFlags ( RS_DISTANT_CHAT_CONTACT_PERMISSION_FLAG_FILTER_EVERYBODY ) ;
2015-12-05 16:49:00 -05:00
break ;
}
}