Commit 59963d8b authored by Jekyll Wu's avatar Jekyll Wu
Browse files

Change the type of TripleClickMode property from bool to enum.

Its correspoding UI in the EditProfileDialog is changed from
checkbox to combobox.

REVIEW:102742
parent d394f5e2
......@@ -1116,8 +1116,6 @@ void EditProfileDialog::setupAdvancedPage(const Profile::Ptr profile)
SLOT(toggleResizeWindow(bool)) },
{ _ui->enableBlinkingCursorButton , Profile::BlinkingCursorEnabled ,
SLOT(toggleBlinkingCursor(bool)) },
{ _ui->tripleClickMode , Profile::TripleClickMode ,
SLOT(toggleTripleClickMode(bool)) },
{ _ui->underlineLinksButton , Profile::UnderlineLinksEnabled,
SLOT(toggleUnderlineLinks(bool)) },
{ _ui->enableBidiRenderingButton , Profile::BidiRenderingEnabled ,
......@@ -1132,6 +1130,12 @@ void EditProfileDialog::setupAdvancedPage(const Profile::Ptr profile)
connect( _ui->wordCharacterEdit , SIGNAL(textChanged(QString)) , this ,
SLOT(wordCharactersChanged(QString)) );
int tripleClickMode = profile->property<int>(Profile::TripleClickMode);
_ui->tripleClickModeCombo->setCurrentIndex(tripleClickMode);
connect( _ui->tripleClickModeCombo , SIGNAL(activated(int)) , this ,
SLOT(TripleClickModeChanged(int)) );
// cursor options
if ( profile->property<bool>(Profile::UseCustomCursorColor) )
_ui->customCursorColorButton->setChecked(true);
......@@ -1200,9 +1204,9 @@ void EditProfileDialog::toggleUnderlineLinks(bool enable)
{
updateTempProfileProperty(Profile::UnderlineLinksEnabled,enable);
}
void EditProfileDialog::toggleTripleClickMode(bool enable)
void EditProfileDialog::TripleClickModeChanged(int newValue)
{
updateTempProfileProperty(Profile::TripleClickMode,enable);
updateTempProfileProperty(Profile::TripleClickMode,newValue);
}
void EditProfileDialog::toggleBlinkingText(bool enable)
{
......
......@@ -165,7 +165,7 @@ private slots:
void toggleResizeWindow(bool);
void togglebidiRendering(bool);
void toggleBlinkingCursor(bool);
void toggleTripleClickMode(bool);
void TripleClickModeChanged(int);
void toggleUnderlineLinks(bool);
void setCursorShape(int);
......
......@@ -986,14 +986,45 @@
</layout>
</item>
<item>
<widget class="QCheckBox" name="tripleClickMode">
<property name="toolTip">
<string>All characters from the current word to the end of line will be selected.</string>
</property>
<property name="text">
<string>Triple click selects from current word forward</string>
</property>
</widget>
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="label_17">
<property name="text">
<string>Triple-click select: </string>
</property>
</widget>
</item>
<item>
<widget class="KComboBox" name="tripleClickModeCombo">
<property name="toolTip">
<string>Which part of current line should be selected with triple click .</string>
</property>
<item>
<property name="text">
<string comment=""> The whole current line</string>
</property>
</item>
<item>
<property name="text">
<string comment=""> From mouse position to the end of line</string>
</property>
</item>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="underlineLinksButton">
......@@ -1065,7 +1096,7 @@
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<spacer name="horizontalSpacer_1">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
......
......@@ -114,7 +114,7 @@ const Profile::PropertyInfo Profile::DefaultPropertyNames[] =
// Interaction
, { WordCharacters , "WordCharacters" , INTERACTION_GROUP , QVariant::String }
, { TripleClickMode , "TripleClickSelectsFromCursor" , INTERACTION_GROUP , QVariant::Bool }
, { TripleClickMode , "TripleClickMode" , INTERACTION_GROUP , QVariant::Int }
, { UnderlineLinksEnabled , "UnderlineLinksEnabled" , INTERACTION_GROUP , QVariant::Bool }
// Encoding
......@@ -179,6 +179,7 @@ FallbackProfile::FallbackProfile()
setProperty(AllowProgramsToResizeWindow,true);
setProperty(BlinkingTextEnabled,true);
setProperty(UnderlineLinksEnabled,true);
setProperty(TripleClickMode,SelectWholeLine);
setProperty(BlinkingCursorEnabled,false);
setProperty(BidiRenderingEnabled,false);
......
......@@ -178,8 +178,8 @@ public:
TabBarPosition,
/** (NewTabBehaviorEnum) Specifies where the newly created tab should be placed. */
NewTabBehavior,
/** (bool) If true, the triple click selects from current word onwards. Otherwise
* selects whole line.
/** (TripleClickModeEnum) Specifies which part of current line should be
* selected with triple click action.
*/
TripleClickMode,
/** (bool) If true, text that matches a link or an email address is underlined when
......@@ -281,6 +281,15 @@ public:
UnderlineCursor = 2
};
/** This enum describes the behavior of triple click action . */
enum TripleClickModeEnum
{
/** Select the whole line underneath the cursor. */
SelectWholeLine = 0,
/** Select from the current cursor position to the end of the line. */
SelectForwardsFromCursor = 1,
};
/**
* Constructs a new profile
*
......
......@@ -868,9 +868,9 @@ void ViewManager::applyProfileToView(TerminalDisplay* view , const Profile::Ptr
bool blinkingText = info->property<bool>(Profile::BlinkingTextEnabled);
view->setBlinkingTextEnabled(blinkingText);
bool tripleClickMode = info->property<bool>(Profile::TripleClickMode);
view->setTripleClickMode(tripleClickMode ? TerminalDisplay::SelectForwardsFromCursor : TerminalDisplay::SelectWholeLine);
int tripleClickMode = info->property<int>(Profile::TripleClickMode);
view->setTripleClickMode( TerminalDisplay::TripleClickMode(tripleClickMode) );
view->setUnderlineLinks(info->property<bool>(Profile::UnderlineLinksEnabled));
bool bidiEnabled = info->property<bool>(Profile::BidiRenderingEnabled);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment