[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [Konversation] 505b71b: Added support for automatic text on highlight
From: Dario Abatianni <eisfuchs () tigress ! com>
Date: 2010-07-01 13:27:22
Message-ID: 20100701132722.E5127BB55C4 () projects ! kde ! org
[Download RAW message or body]
commit 505b71b97be407dcceb4c77074a8cc6b39456ed2
Author: Dario Abatianni <eisfuchs@tigress.com>
Date: Thu Mar 25 12:48:27 2004 +0000
Added support for automatic text on highlight
svn path=/trunk/kdeextragear-2/konversation/; revision=298502
diff --git a/konversation/channel.cpp b/konversation/channel.cpp
index ab9a2ee..ec802d7 100644
--- a/konversation/channel.cpp
+++ b/konversation/channel.cpp
@@ -247,6 +247,7 @@ Channel::Channel(QWidget* parent) : ChatWindow(parent)
connect(textView,SIGNAL (newText(const QString&,bool)),this,SLOT \
(newTextInView(const QString&,bool)) ); connect(textView,SIGNAL \
(gotFocus()),this,SLOT (adjustFocus()) ); connect(textView,SIGNAL \
(sendFile()),this,SLOT (sendFileMenu()) ); + connect(textView,SIGNAL (autoText(const \
QString&)),this,SLOT (sendChannelText(const QString&)) );
connect(nicknameListView,SIGNAL (popupCommand(int)),this,SLOT (popupCommand(int)) \
); connect(nicknameListView,SIGNAL (doubleClicked(QListViewItem*)),this,SLOT \
(doubleClickCommand(QListViewItem*)) );
diff --git a/konversation/commit.h b/konversation/commit.h
index a47fb77..cd6917d 100644
--- a/konversation/commit.h
+++ b/konversation/commit.h
@@ -1 +1 @@
-#define COMMIT 1870
+#define COMMIT 1871
diff --git a/konversation/dccchat.cpp b/konversation/dccchat.cpp
index 4fd4aa1..e2443fc 100644
--- a/konversation/dccchat.cpp
+++ b/konversation/dccchat.cpp
@@ -69,6 +69,7 @@ DccChat::DccChat(QWidget* parent,const QString& myNickname,const \
QString& nickna
connect(getTextView(),SIGNAL (gotFocus()),this,SLOT (adjustFocus()) );
connect(getTextView(),SIGNAL (newText(const QString&,bool)),this,SLOT \
(newTextInView(const QString&,bool)) ); + connect(getTextView(),SIGNAL \
(autoText(const QString&)),this,SLOT (sendDccChatText(const QString&)) );
if(listen)
listenForPartner();
diff --git a/konversation/highlight.cpp b/konversation/highlight.cpp
index 7e8812e..ef3133e 100644
--- a/konversation/highlight.cpp
+++ b/konversation/highlight.cpp
@@ -19,9 +19,14 @@
unsigned int Highlight::s_id = 0; // static
-Highlight::Highlight(const QString& itemPattern,bool regExp,const QColor& itemColor, \
const KURL& soundURL) +Highlight::Highlight(const QString& itemPattern,
+ bool regExp,
+ const QColor& itemColor,
+ const KURL& soundURL,
+ const QString& autoText)
{
m_itemPattern = itemPattern;
+ m_autoText = autoText;
m_itemColor = itemColor;
m_soundURL = soundURL;
m_regExp = regExp;
@@ -36,10 +41,12 @@ Highlight::~Highlight()
int Highlight::getID() { return m_itemID; }
QString Highlight::getPattern() { return m_itemPattern; }
+QString Highlight::getAutoText() { return m_autoText; }
QColor Highlight::getColor() { return m_itemColor; }
KURL Highlight::getSoundURL() { return m_soundURL; }
void Highlight::setPattern(const QString& itemPattern) { m_itemPattern = \
itemPattern; } +void Highlight::setAutoText(const QString& autoText) { m_autoText = \
autoText; } void Highlight::setColor(const QColor& itemColor) { m_itemColor = \
itemColor; } void Highlight::setSoundURL(const KURL& url) { m_soundURL = url; }
diff --git a/konversation/highlight.h b/konversation/highlight.h
index 75fa901..db7cd34 100644
--- a/konversation/highlight.h
+++ b/konversation/highlight.h
@@ -31,10 +31,15 @@
class Highlight
{
public:
- Highlight(const QString& itemPattern,bool regExp,const QColor& itemColor, const \
KURL& soundURL); + Highlight(const QString& itemPattern,
+ bool regExp,
+ const QColor& itemColor,
+ const KURL& soundURL,
+ const QString& autoText);
~Highlight();
QString getPattern();
+ QString getAutoText();
QColor getColor();
int getID();
bool getRegExp();
@@ -43,6 +48,7 @@ class Highlight
void setPattern(const QString& itemPattern);
void setColor(const QColor& itemColor);
void setSoundURL(const KURL& url);
+ void setAutoText(const QString& autoText);
void setRegExp(bool state);
protected:
@@ -52,6 +58,7 @@ class Highlight
bool m_regExp;
QString m_itemPattern;
+ QString m_autoText;
QColor m_itemColor;
KURL m_soundURL;
};
diff --git a/konversation/highlightviewitem.cpp b/konversation/highlightviewitem.cpp
index c91426e..1e954d4 100644
--- a/konversation/highlightviewitem.cpp
+++ b/konversation/highlightviewitem.cpp
@@ -26,6 +26,7 @@ HighlightViewItem::HighlightViewItem(QListView* parent, Highlight* \
passed_Highli itemColor = passed_Highlight->getColor();
itemID = passed_Highlight->getID();
setSoundURL(passed_Highlight->getSoundURL());
+ setAutoText(passed_Highlight->getAutoText());
setOn(passed_Highlight->getRegExp());
}
@@ -55,7 +56,18 @@ void HighlightViewItem::setSoundURL(const KURL& url)
setText(2, soundURL.prettyURL());
}
+void HighlightViewItem::setAutoText(const QString& newAutoText)
+{
+ autoText = newAutoText;
+ setText(3,newAutoText);
+}
+
bool HighlightViewItem::getRegExp()
{
return isOn();
}
+
+QString HighlightViewItem::getAutoText()
+{
+ return autoText;
+}
diff --git a/konversation/highlightviewitem.h b/konversation/highlightviewitem.h
index ce77139..3bb600b 100644
--- a/konversation/highlightviewitem.h
+++ b/konversation/highlightviewitem.h
@@ -35,12 +35,14 @@ class HighlightViewItem : public QCheckListItem
~HighlightViewItem();
QString getPattern();
+ QString getAutoText();
QColor getColor() { return itemColor; }
int getID() { return itemID; }
bool getRegExp();
KURL getSoundURL() { return soundURL; }
void setPattern(const QString& newPattern);
+ void setAutoText(const QString& newAutoText);
void setColor(QColor passed_itemColor) { itemColor = passed_itemColor; }
void setID(int passed_itemID) { itemID = passed_itemID; }
void setSoundURL(const KURL& url);
@@ -52,6 +54,7 @@ class HighlightViewItem : public QCheckListItem
QColorGroup itemColorGroup;
int itemID;
KURL soundURL;
+ QString autoText;
void paintCell(QPainter* p, const QColorGroup &cg, int column, int width, int \
alignment); };
diff --git a/konversation/irccolorchooserui.ui b/konversation/irccolorchooserui.ui
index 9784ff0..c8521fb 100644
--- a/konversation/irccolorchooserui.ui
+++ b/konversation/irccolorchooserui.ui
@@ -1,4 +1,4 @@
-<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
<class>IRCColorChooserUI</class>
<widget class="QWidget">
<property name="name">
diff --git a/konversation/ircview.cpp b/konversation/ircview.cpp
index 19a658f..3deb359 100644
--- a/konversation/ircview.cpp
+++ b/konversation/ircview.cpp
@@ -65,6 +65,7 @@ IRCView::IRCView(QWidget* parent,Server* newServer) : \
KTextBrowser(parent) copyUrlMenu=false;
urlToCopy=QString::null;
resetScrollbar=false;
+ autoTextToSend=QString::null;
popup=new QPopupMenu(this,"ircview_context_menu");
@@ -426,7 +427,8 @@ QString IRCView::filter(const QString& line,const QString& \
defaultColor,const QS
KonversationApplication *konvApp=static_cast<KonversationApplication \
*>(KApplication::kApplication());
konvApp->sound()->play(hilightList.at(index)->getSoundURL());
}
-
+ // only set auto text if it was someone else but ourselves
+ if(whoSent!=server->getNickname()) \
autoTextToSend=hilight->getAutoText(); break;
}
} // endfor
@@ -639,6 +641,14 @@ void IRCView::doAppend(QString newLine,bool \
suppressTimestamps,bool important) ensureVisible(0,contentsHeight());
}
}
+ if(!autoTextToSend.isEmpty())
+ {
+ // avoid recursion due to signalling
+ QString sendText=autoTextToSend;
+ autoTextToSend=QString::null;
+ // send signal only now
+ emit autoText(sendText);
+ }
}
// remember if scrollbar was positioned at the end of the text or not
diff --git a/konversation/ircview.h b/konversation/ircview.h
index 45bb8f9..b079365 100644
--- a/konversation/ircview.h
+++ b/konversation/ircview.h
@@ -56,6 +56,7 @@ class IRCView : public KTextBrowser
void textToLog(const QString& text);
void sendFile();
void extendedPopup(int id);
+ void autoText(const QString& text);
public slots:
void append(const QString& nick,const QString& message);
@@ -94,6 +95,7 @@ class IRCView : public KTextBrowser
// decide if we should place the scrollbar at the bottom on show()
bool resetScrollbar;
+ QString autoTextToSend;
QString highlightColor;
bool copyUrlMenu;
QString urlToCopy;
diff --git a/konversation/konversationapplication.cpp \
b/konversation/konversationapplication.cpp index e2108a0..7aac80b 100644
--- a/konversation/konversationapplication.cpp
+++ b/konversation/konversationapplication.cpp
@@ -484,7 +484,7 @@ void KonversationApplication::readOptions()
unsigned int hiIndex;
for(hiIndex=0;hiIndex<hiList.count();hiIndex+=2)
{
- preferences.addHilight(hiList[hiIndex],false,"#"+hiList[hiIndex+1], "");
+ preferences.addHilight(hiList[hiIndex],false,"#"+hiList[hiIndex+1],QString::null,QString::null);
}
config->deleteEntry("Hilight");
@@ -496,7 +496,8 @@ void KonversationApplication::readOptions()
preferences.addHilight(config->readEntry("Pattern"),
config->readBoolEntry("RegExp"),
config->readColorEntry("Color"),
- config->readPathEntry("Sound"));
+ config->readPathEntry("Sound"),
+ config->readEntry("AutoText"));
i++;
}
}
@@ -722,6 +723,7 @@ void KonversationApplication::saveOptions(bool updateGUI)
config->writeEntry("RegExp", hl->getRegExp());
config->writeEntry("Color", hl->getColor());
config->writePathEntry("Sound", hl->getSoundURL().prettyURL());
+ config->writeEntry("AutoText", hl->getAutoText());
i++;
}
diff --git a/konversation/preferences.cpp b/konversation/preferences.cpp
index 14f4c93..d7ce02c 100644
--- a/konversation/preferences.cpp
+++ b/konversation/preferences.cpp
@@ -290,9 +290,13 @@ void Preferences::setHilightList(QPtrList<Highlight> newList)
hilightList=newList;
}
-void Preferences::addHilight(const QString& newHilight,bool regExp,QColor \
newColor,const QString& sound) +void Preferences::addHilight(const QString& \
newHilight, + bool regExp,
+ QColor newColor,
+ const QString& sound,
+ const QString& autoText)
{
- hilightList.append(new Highlight(newHilight,regExp,newColor,KURL(sound)));
+ hilightList.append(new \
Highlight(newHilight,regExp,newColor,KURL(sound),autoText)); }
void Preferences::setHilightSoundEnabled(bool enabled)
diff --git a/konversation/preferences.h b/konversation/preferences.h
index 90f7934..a785100 100644
--- a/konversation/preferences.h
+++ b/konversation/preferences.h
@@ -174,7 +174,7 @@ class Preferences : public QObject
QPtrList<Highlight> getHilightList();
void setHilightList(QPtrList<Highlight> newList);
- void addHilight(const QString& newHilight,bool regExp,QColor color,const \
QString& sound); + void addHilight(const QString& newHilight,bool regExp,QColor \
color,const QString& sound,const QString& autoText); void \
setHilightSoundEnabled(bool enabled); bool getHilightSoundEnabled();
diff --git a/konversation/prefspagehighlight.cpp \
b/konversation/prefspagehighlight.cpp index cb06cab..5b22e2d 100644
--- a/konversation/prefspagehighlight.cpp
+++ b/konversation/prefspagehighlight.cpp
@@ -53,6 +53,7 @@ PrefsPageHighlight::PrefsPageHighlight(QFrame* \
newParent,Preferences* newPrefere highlightListView->addColumn(i18n("RE"));
highlightListView->addColumn(i18n("Highlights"));
highlightListView->addColumn(i18n("Sound"));
+ highlightListView->addColumn(i18n("Auto Text"));
highlightListView->setAllColumnsShowFocus(true);
highlightListView->setFullWidth(true);
highlightListView->setDragEnabled(true);
@@ -84,12 +85,20 @@ PrefsPageHighlight::PrefsPageHighlight(QFrame* \
newParent,Preferences* newPrefere soundURL = new KURLRequester(highlightSoundBox, \
"highlight_sound_url"); soundLabel->setBuddy(soundURL);
+ QHBox* autoTextBox=new QHBox(highlightListBox);
+ autoTextBox->setSpacing(spacingHint());
+ autoTextLabel=new QLabel(i18n("&Auto text:"),autoTextBox);
+ autoTextInput=new KLineEdit(autoTextBox,"auto_text_input");
+ autoTextLabel->setBuddy(autoTextInput);
+
patternLabel->setEnabled(false);
patternInput->setEnabled(false);
patternColor->setEnabled(false);
soundURL->setEnabled(false);
soundLabel->setEnabled(false);
soundPlayBtn->setEnabled(false);
+ autoTextInput->setEnabled(false);
+ autoTextLabel->setEnabled(false);
QString filter = "audio/x-wav audio/x-mp3 application/ogg audio/x-adpcm";
soundURL->setFilter(filter);
@@ -162,6 +171,8 @@ PrefsPageHighlight::PrefsPageHighlight(QFrame* \
newParent,Preferences* newPrefere connect(soundURL, SIGNAL(textChanged(const \
QString&)), this, SLOT(soundURLChanged(const QString&))); connect(soundPlayBtn, \
SIGNAL(clicked()), this, SLOT(playSound()));
+ connect(autoTextInput, SIGNAL(textChanged(const QString&)), this, \
SLOT(autoTextChanged(const QString&))); +
connect(newButton,SIGNAL (clicked()),this,SLOT (addHighlight()) );
connect(removeButton,SIGNAL (clicked()),this,SLOT (removeHighlight()) );
@@ -185,10 +196,13 @@ void PrefsPageHighlight::highlightSelected(QListViewItem* item)
soundURL->setEnabled(true);
soundLabel->setEnabled(true);
soundPlayBtn->setEnabled(true);
+ autoTextLabel->setEnabled(true);
+ autoTextInput->setEnabled(true);
patternColor->setColor(highlightItem->getColor());
patternInput->setText(highlightItem->getPattern());
soundURL->setURL(highlightItem->getSoundURL().prettyURL());
+ autoTextInput->setText(highlightItem->getAutoText());
}
else
{
@@ -229,9 +243,19 @@ void PrefsPageHighlight::soundURLChanged(const QString& newURL)
}
}
+void PrefsPageHighlight::autoTextChanged(const QString& newAutoText)
+{
+ HighlightViewItem* \
item=static_cast<HighlightViewItem*>(highlightListView->selectedItem()); +
+ if(item)
+ {
+ item->setAutoText(newAutoText);
+ }
+}
+
void PrefsPageHighlight::addHighlight()
{
- Highlight* newHighlight=new Highlight(i18n("New"),false,QColor("#ff0000"),KURL());
+ Highlight* newHighlight=new \
Highlight(i18n("New"),false,QColor("#ff0000"),KURL(),QString::null);
HighlightViewItem* item=new HighlightViewItem(highlightListView,newHighlight);
highlightListView->setSelected(item,true);
@@ -257,6 +281,8 @@ void PrefsPageHighlight::removeHighlight()
soundURL->setEnabled(false);
soundLabel->setEnabled(false);
soundPlayBtn->setEnabled(false);
+ autoTextLabel->setEnabled(false);
+ autoTextInput->setEnabled(false);
}
}
}
@@ -268,7 +294,11 @@ QPtrList<Highlight> PrefsPageHighlight::getHighlightList()
HighlightViewItem* \
item=static_cast<HighlightViewItem*>(highlightListView->firstChild()); while(item)
{
- newList.append(new \
Highlight(item->getPattern(),item->getRegExp(),item->getColor(),item->getSoundURL()));
+ newList.append(new Highlight(item->getPattern(),
+ item->getRegExp(),
+ item->getColor(),
+ item->getSoundURL(),
+ item->getAutoText()));
item=item->itemBelow();
}
diff --git a/konversation/prefspagehighlight.h b/konversation/prefspagehighlight.h
index 9baf14d..f78e265 100644
--- a/konversation/prefspagehighlight.h
+++ b/konversation/prefspagehighlight.h
@@ -51,6 +51,7 @@ class PrefsPageHighlight : public PrefsPage
void highlightTextChanged(const QString& newPattern);
void highlightColorChanged(const QColor& newColor);
void soundURLChanged(const QString& newURL);
+ void autoTextChanged(const QString& newURL);
void addHighlight();
void removeHighlight();
@@ -73,6 +74,8 @@ class PrefsPageHighlight : public PrefsPage
QLabel* soundLabel;
QPushButton* soundPlayBtn;
QCheckBox* enableSoundCheck;
+ QLabel* autoTextLabel;
+ KLineEdit* autoTextInput;
};
#endif
diff --git a/konversation/query.cpp b/konversation/query.cpp
index edce3a7..f0f1da3 100644
--- a/konversation/query.cpp
+++ b/konversation/query.cpp
@@ -72,6 +72,7 @@ Query::Query(QWidget* parent) : ChatWindow(parent)
connect(textView,SIGNAL (gotFocus()),this,SLOT (adjustFocus()) );
connect(textView,SIGNAL (sendFile()),this,SLOT (sendFileMenu()) );
connect(textView,SIGNAL (extendedPopup(int)),this,SLOT (popup(int)) );
+ connect(textView,SIGNAL (autoText(const QString&)),this,SLOT (sendQueryText(const \
QString&)) );
updateFonts();
diff --git a/konversation/statuspanel.cpp b/konversation/statuspanel.cpp
index 465bfd4..9442faa 100644
--- a/konversation/statuspanel.cpp
+++ b/konversation/statuspanel.cpp
@@ -52,6 +52,7 @@ StatusPanel::StatusPanel(QWidget* parent) :
connect(getTextView(),SIGNAL (newText(const QString&,bool)),this,SLOT \
(newTextInView(const QString&,bool)) ); connect(getTextView(),SIGNAL \
(sendFile()),this,SLOT (sendFileMenu()) ); + connect(getTextView(),SIGNAL \
(autoText(const QString&)),this,SLOT (sendChannelText(const QString&)) );
connect(statusInput,SIGNAL (pageUp()),getTextView(),SLOT (pageUp()) );
connect(statusInput,SIGNAL (pageDown()),getTextView(),SLOT (pageDown()) );
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic