[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [Konversation] 0f81e36: Added an away nickname
From:       Peter Simonsson <peter.simonsson () gmail ! com>
Date:       2010-07-01 13:27:07
Message-ID: 20100701132707.970D2BB5510 () projects ! kde ! org
[Download RAW message or body]


	A	 konversation/konversation.upd	 [License: Trivialfile.]

commit 0f81e3679c85815c4a4a9cea32e37b0ff7180b7a
Author: Peter Simonsson <peter.simonsson@gmail.com>
Date:   Wed Dec 3 21:54:34 2003 +0000

    Added an away nickname
    
    svn path=/trunk/kdeextragear-2/konversation/; revision=271036

diff --git a/ChangeLog b/ChangeLog
index 13469a8..a233073 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,7 @@ Changes from 0.13 to 0.14
 - Implemented DCC Chat
 - Hilight mailto: links
 - Topic line can now be hidden
+- Added an away nickname
 
 Changes from 0.12 to 0.13
 - Added an option to hide hostmasks in channel nick lists
diff --git a/konversation/Makefile.am b/konversation/Makefile.am
index a27253f..f3c5d92 100644
--- a/konversation/Makefile.am
+++ b/konversation/Makefile.am
@@ -38,7 +38,7 @@ rc_DATA = konversationui.rc eventsrc
 KDE_ICON = AUTO
 
 updatedir = $(kde_datadir)/kconf_update
-update_DATA = konversation-0.14-mainwindow.pl
+update_DATA = konversation.upd konversation-0.14-mainwindow.pl
 
 messages: rc.cpp
 	LIST=`find . -name \*.h -o -name \*.hh -o -name \*.H -o -name \*.hxx -o -name \
\*.hpp -o -name \*.cpp -o -name \*.cc -o -name \*.cxx -o -name \*.ecpp -o -name \
                \*.C`; \
diff --git a/konversation/identity.cpp b/konversation/identity.cpp
index 78c916b..c3d7a59 100644
--- a/konversation/identity.cpp
+++ b/konversation/identity.cpp
@@ -77,3 +77,6 @@ void Identity::setCodec(const QString &newCodec)
   // never set an empty codec!
   if(!newCodec.isEmpty()) codec=newCodec;
 }
+
+QString Identity::getAwayNick() { return awayNick; }
+void Identity::setAwayNick(const QString& n) { awayNick = n; }
diff --git a/konversation/identity.h b/konversation/identity.h
index 57b0b20..1aeb9fb 100644
--- a/konversation/identity.h
+++ b/konversation/identity.h
@@ -61,6 +61,9 @@ class Identity
 
     void setCodec(const QString &newCodec);
     QString getCodec() const;
+    
+    QString getAwayNick();
+    void setAwayNick(const QString& n);
 
   protected:
     QString name;
@@ -80,6 +83,8 @@ class Identity
     QString awayMessage;
     QString returnMessage;
     QString codec;
+    
+    QString awayNick;
 };
 
 #endif
diff --git a/konversation/konversation.upd b/konversation/konversation.upd
new file mode 100644
index 0000000..bc629ea
--- /dev/null
+++ b/konversation/konversation.upd
@@ -0,0 +1,5 @@
+# Update mainwindow settings
+Id=0.14-mainwindow
+File=konversationrc
+Group=General Settings
+Script=konversation-0.14-mainwindow.pl,perl
diff --git a/konversation/konversationapplication.cpp \
b/konversation/konversationapplication.cpp index d2a6b4b..70cb2a0 100644
--- a/konversation/konversationapplication.cpp
+++ b/konversation/konversationapplication.cpp
@@ -364,6 +364,8 @@ void KonversationApplication::readOptions()
       newIdentity->setKickReason(config->readEntry("KickReason"));
 
       newIdentity->setCodec(config->readEntry("Codec"));
+      
+      newIdentity->setAwayNick(config->readEntry("AwayNick"));
 
       preferences.addIdentity(newIdentity);
 
@@ -629,6 +631,7 @@ void KonversationApplication::saveOptions(bool updateGUI)
     config->writeEntry("PartReason",identity->getPartReason());
     config->writeEntry("KickReason",identity->getKickReason());
     config->writeEntry("Codec",identity->getCodec().stripWhiteSpace());
+    config->writeEntry("AwayNick", identity->getAwayNick());
   } // endfor
 
   config->setGroup("Notify List");
diff --git a/konversation/preferences.cpp b/konversation/preferences.cpp
index 8c4cb51..2048c68 100644
--- a/konversation/preferences.cpp
+++ b/konversation/preferences.cpp
@@ -386,7 +386,7 @@ void Preferences::removeIdentity(Identity* identity) { \
identityList.remove(ident  void Preferences::clearIdentityList() { \
identityList.clear(); }  QPtrList<Identity> Preferences::getIdentityList() { return \
identityList; }  
-const Identity * Preferences::getIdentityByName(const QString& name)
+Identity * Preferences::getIdentityByName(const QString& name)
 {
   QPtrList<Identity> identities=getIdentityList();
   Identity* identity=identities.first();
diff --git a/konversation/preferences.h b/konversation/preferences.h
index 4d4e905..1ab5987 100644
--- a/konversation/preferences.h
+++ b/konversation/preferences.h
@@ -220,7 +220,7 @@ class Preferences : public QObject
     void removeIdentity(Identity* identity);
     void clearIdentityList();
     QPtrList<Identity> getIdentityList();
-    const Identity *getIdentityByName(const QString& name);
+    Identity *getIdentityByName(const QString& name);
     Identity* identity;
 
     QString getIdent();
@@ -358,7 +358,7 @@ class Preferences : public QObject
 
     bool getShowTopic();
     void setShowTopic(bool s);
-
+    
   signals:
     void requestServerConnection(int number);
     void requestSaveOptions();
diff --git a/konversation/prefspageidentity.cpp b/konversation/prefspageidentity.cpp
index e51ff2b..410fb31 100644
--- a/konversation/prefspageidentity.cpp
+++ b/konversation/prefspageidentity.cpp
@@ -116,6 +116,10 @@ PrefsPageIdentity::PrefsPageIdentity(QFrame* \
newParent,Preferences* newPreferenc  unAwayLabel=new QLabel(i18n("Re&turn \
message:"),parentFrame);  unAwayInput=new KLineEdit(parentFrame);
   unAwayLabel->setBuddy(unAwayInput);
+  
+  QLabel* awayNickLabel = new QLabel(i18n("Away nickname:"), parentFrame);
+  awayNickInput = new KLineEdit(parentFrame);
+  awayNickLabel->setBuddy(awayNickInput);
 
   defaultText=new QLabel(i18n("<qt>This is the default identity used for all servers \
                "
                               "where no separate identity was selected.</qt>"),
@@ -174,6 +178,9 @@ PrefsPageIdentity::PrefsPageIdentity(QFrame* \
newParent,Preferences* newPreferenc  identityLayout->addWidget(unAwayLabel,row,0);
   identityLayout->addMultiCellWidget(unAwayInput,row,row,1,3);
   row++;
+  identityLayout->addWidget(awayNickLabel, row, 0);
+  identityLayout->addMultiCellWidget(awayNickInput, row, row, 1, 3);
+  row++;
   identityLayout->addMultiCellWidget(defaultText,row,row,0,3);
   row++;
   identityLayout->addMultiCellWidget(buttonBox,row,row,0,3);
@@ -207,6 +214,8 @@ PrefsPageIdentity::PrefsPageIdentity(QFrame* \
newParent,Preferences* newPreferenc  connect(showAwayMessageCheck,SIGNAL \
(stateChanged(int)),this,SLOT (showAwayMessageChanged(int)) );  \
connect(awayInput,SIGNAL (textChanged(const QString&)),this,SLOT \
(awayMessageChanged(const QString&)) );  connect(unAwayInput,SIGNAL \
(textChanged(const QString&)),this,SLOT (unAwayMessageChanged(const QString&)) ); +  
+  connect(awayNickInput, SIGNAL(textChanged(const QString&)), this, \
SLOT(awayNickChanged(const QString&)));  
   connect(addIdentityButton,SIGNAL (clicked()),this,SLOT(addIdentity()) );
   connect(removeIdentityButton,SIGNAL (clicked()),this,SLOT(removeIdentity()) );
@@ -334,6 +343,8 @@ void PrefsPageIdentity::updateIdentity(int number)
   showAwayMessageCheck->setChecked(identity->getShowAwayMessage());
   awayInput->setText(identity->getAwayMessage());
   unAwayInput->setText(identity->getReturnMessage());
+  
+  awayNickInput->setText(identity->getAwayNick());
 
   updateAwayWidgets(identity->getShowAwayMessage());
 }
@@ -394,4 +405,9 @@ void PrefsPageIdentity::applyPreferences()
   // FIXME: keep a copy of all identities and save them only here!
 }
 
+void PrefsPageIdentity::awayNickChanged(const QString& newNick)
+{
+  identity->setAwayNick(newNick);
+}
+
 #include "prefspageidentity.moc"
diff --git a/konversation/prefspageidentity.h b/konversation/prefspageidentity.h
index 4a002a4..a9bc49e 100644
--- a/konversation/prefspageidentity.h
+++ b/konversation/prefspageidentity.h
@@ -70,6 +70,8 @@ class PrefsPageIdentity : public PrefsPage
 
     void addIdentity();
     void removeIdentity();
+    
+    void awayNickChanged(const QString& newNick);
 
   protected:
     QPtrList<Identity> identities;
@@ -102,6 +104,8 @@ class PrefsPageIdentity : public PrefsPage
     QLabel* unAwayLabel;
     KLineEdit* awayInput;
     KLineEdit* unAwayInput;
+    
+    KLineEdit* awayNickInput;
 
     QPushButton* removeIdentityButton;
 };
diff --git a/konversation/server.cpp b/konversation/server.cpp
index 1c78415..cfbf16e 100644
--- a/konversation/server.cpp
+++ b/konversation/server.cpp
@@ -1603,12 +1603,21 @@ void Server::away()
 {
   isAway=true;
   emit awayState(isAway);
+  
+  if(!getIdentity()->getAwayNick().isEmpty()) {
+    nonAwayNick = getNickname();
+    queue("NICK " + getIdentity()->getAwayNick());
+  }
 }
 
 void Server::unAway()
 {
   isAway=false;
   emit awayState(isAway);
+  
+  if(!getIdentity()->getAwayNick().isEmpty() && !nonAwayNick.isEmpty()) {
+    queue("NICK " + nonAwayNick);
+  }
 }
 
 bool Server::isAChannel(const QString &check)
@@ -1673,8 +1682,8 @@ void Server::autoRejoinChannels()
   queue(joinString);
 }
 
-void Server::setIdentity(const Identity* newIdentity) { identity=newIdentity; }
-const Identity* Server::getIdentity() { return identity; }
+void Server::setIdentity(Identity* newIdentity) { identity=newIdentity; }
+Identity* Server::getIdentity() { return identity; }
 
 void Server::setMainWindow(KonversationMainWindow* newMainWindow) { \
mainWindow=newMainWindow; }  KonversationMainWindow* Server::getMainWindow() const { \
                return mainWindow; }
diff --git a/konversation/server.h b/konversation/server.h
index 77408a1..b557976 100644
--- a/konversation/server.h
+++ b/konversation/server.h
@@ -44,7 +44,7 @@ class Server : public QObject
     ~Server();
 
     QString getServerName() const;
-    const Identity *getIdentity();
+    Identity *getIdentity();
     int getPort() const;
     int getLag() const;
     bool getAutoJoin() const;
@@ -212,7 +212,7 @@ class Server : public QObject
     void lookupFinished();
     void startNotifyCheckTimer();
     bool isAChannel(const QString &check);
-    void setIdentity(const Identity *newIdentity);
+    void setIdentity(Identity *newIdentity);
     
     void autoRejoinChannels();
 
@@ -229,7 +229,7 @@ class Server : public QObject
     QString serverNickPrefixModes;  // if supplied: modes related to those prefixes
 
     IRCResolver resolver;
-    const Identity* identity;
+    Identity* identity;
 
     bool autoJoin;
     bool autoRejoin;
@@ -273,6 +273,8 @@ class Server : public QObject
     bool isAway;
     bool alreadyConnected;
     bool rejoinChannels;
+    
+    QString nonAwayNick;
 };
 
 #endif


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic