rpms/kdebase/FC-5 kdebase-3.5.2-konsole.patch,NONE,1.1

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Tue May 23 17:08:22 UTC 2006


Author: than

Update of /cvs/dist/rpms/kdebase/FC-5
In directory cvs.devel.redhat.com:/tmp/cvs-serv558

Added Files:
	kdebase-3.5.2-konsole.patch 
Log Message:
fix #192832, konsole crashes on kde logout


kdebase-3.5.2-konsole.patch:
 BlockArray.cpp |    1 
 TEScreen.cpp   |    1 
 TEmuVt102.cpp  |    5 +-
 konsole.cpp    |  136 +++++++++++++++++++++++++++++++--------------------------
 konsole.h      |    2 
 kwrited.cpp    |   43 +++++++++++++-----
 kwrited.h      |    7 ++
 session.cpp    |   21 +++++++-
 session.h      |    2 
 9 files changed, 137 insertions(+), 81 deletions(-)

--- NEW FILE kdebase-3.5.2-konsole.patch ---
diff -Nur kdebase-3.5.2/konsole.orig/konsole/BlockArray.cpp kdebase-3.5.2/konsole/konsole/BlockArray.cpp
--- kdebase-3.5.2/konsole.orig/konsole/BlockArray.cpp	2005-09-10 10:26:08.000000000 +0200
+++ kdebase-3.5.2/konsole/konsole/BlockArray.cpp	2006-04-25 17:12:29.000000000 +0200
@@ -210,6 +210,7 @@
 
     FILE *fion = fdopen(dup(ion), "w+b");
     if (!fion) {
+        delete [] buffer1;
         perror("fdopen/dup");
         return;
     }
diff -Nur kdebase-3.5.2/konsole.orig/konsole/konsole.cpp kdebase-3.5.2/konsole/konsole/konsole.cpp
--- kdebase-3.5.2/konsole.orig/konsole/konsole.cpp	2006-03-17 11:17:43.000000000 +0100
+++ kdebase-3.5.2/konsole/konsole/konsole.cpp	2006-05-23 17:59:30.000000000 +0200
@@ -214,6 +214,7 @@
 ,selectScrollbar(0)
 ,selectTabbar(0)
 ,selectBell(0)
+,selectSetEncoding(0)
 ,m_clearHistory(0)
 ,m_findHistory(0)
 ,m_saveHistory(0)
@@ -844,6 +845,7 @@
     }
 }
 
+// Called via menu
 void Konsole::slotSetEncoding()
 {
   if (!se) return;
@@ -1363,6 +1365,7 @@
     else
       title = sessions.at(i)->Title();
 
+    title=title.replace('&',"&&");
     switch(mode) {
       case ShowIconAndText:
         tabwidget->changeTab(page, icon, title);
@@ -2186,18 +2189,25 @@
   if (n_render >= 3) pixmap_menu_activated(n_render);
 }
 
-void Konsole::updateTitle()
+void Konsole::updateTitle(TESession* _se)
 {
-  setCaption( se->fullTitle() );
-  setIconText( se->IconText() );
-  tabwidget->setTabIconSet(se->widget(), iconSetForSession(se));
-  QString icon = se->IconName();
-  KRadioAction *ra = session2action.find(se);
+  if ( !_se )
+    _se = se;
+
+  if (_se == se)
+  {
+    setCaption( _se->fullTitle() );
+    setIconText( _se->IconText() );
+  }
+  tabwidget->setTabIconSet(_se->widget(), iconSetForSession(_se));
+  QString icon = _se->IconName();
+  KRadioAction *ra = session2action.find(_se);
   if (ra && (ra->icon() != icon))
     ra->setIcon(icon);
-  if (m_tabViewMode == ShowIconOnly) tabwidget->changeTab( se->widget(), QString::null );
+  if (m_tabViewMode == ShowIconOnly) 
+    tabwidget->changeTab( _se->widget(), QString::null );
   else if (b_matchTabWinTitle)
-    tabwidget->changeTab( se->widget(), se->fullTitle() );
+    tabwidget->changeTab( _se->widget(), _se->fullTitle().replace('&',"&&"));
 }
 
 void Konsole::initSessionFont(QFont font) {
@@ -2610,9 +2620,7 @@
   activateSession(oldSession);
 }
 
-// Set session encoding; don't use any menu items.
-// System's encoding list may change, so search for encoding string.
-// FIXME: A lot of duplicate code from slotSetSessionEncoding
+// Called by newSession and DCOP function below
 void Konsole::setSessionEncoding( const QString &encoding, TESession *session )
 {
     if ( encoding.isEmpty() )
@@ -2630,58 +2638,39 @@
     // Encoding was found; now try to figure out which Encoding menu item
     // it corresponds to.
     int i = 0;
+    bool found_encoding = false;
     QStringList encodingNames = KGlobal::charsets()->descriptiveEncodingNames();
-    QStringList::Iterator it = encodingNames.begin();
-    while ( it != encodingNames.end() && 
-            KGlobal::charsets()->encodingForName(*it) != encoding )
+    QStringList::ConstIterator it = encodingNames.begin();
+    QString t_encoding = encoding.lower();
+
+    while ( it != encodingNames.end() && !found_encoding )
     {
+      if ( QString::compare( KGlobal::charsets()->encodingForName(*it), 
+                             t_encoding ) == 0 ) {
+         found_encoding = true;
+      }
       i++; it++;
     }
 
-    i++;                 // Take into account the first entry: Default
-    //kdDebug()<<"setSessionEncoding="<<encoding<<"; "<<i<<endl;
+    // BR114535 : Remove jis7 due to infinite loop.
+    if ( enc == "jis7" ) {
+      kdWarning()<<"Encoding Japanese (jis7) currently does not work!  BR114535"<<endl;
+      return;
+    }
 
-    session->setEncodingNo( i );
-    session->getEmulation()->setCodec(qtc);
-    if (se == session)
+    if ( found_encoding )
+    {
+      session->setEncodingNo( i );
+      session->getEmulation()->setCodec(qtc);
+      if (se == session)
         activateSession(se);
-
+    }
 }
 
+// Called via DCOP only
 void Konsole::slotSetSessionEncoding(TESession *session, const QString &encoding)
 {
-  if (!selectSetEncoding)
-     makeGUI();
-
-  if ( !selectSetEncoding )         // when action/settings=false
-    return;
-
-  QStringList items = selectSetEncoding->items();
-
-  QString enc;
-  unsigned int i = 0;
-  for(QStringList::ConstIterator it = items.begin();
-      it != items.end(); ++it, ++i)
-  {
-     if ((*it).find(encoding) != -1)
-     {
-        enc = *it;
-        break;
-     }
-  }
-  if (i >= items.count())
-     return;
-
-  bool found = false;
-  enc = KGlobal::charsets()->encodingForName(enc);
-  QTextCodec * qtc = KGlobal::charsets()->codecForName(enc, found);
-  if(!found)
-     return;
-
-  session->setEncodingNo( i + 1 );    // Take into account Default
-  session->getEmulation()->setCodec(qtc);
-  if (se == session)
-     activateSession(se);
+   setSessionEncoding( encoding, session );
 }
 
 void Konsole::slotGetSessionSchema(TESession *session, QString &schema)
@@ -2705,8 +2694,11 @@
 
 KSimpleConfig *Konsole::defaultSession()
 {
-  if (!m_defaultSession)
-    setDefaultSession("shell.desktop");
+  if (!m_defaultSession) {
+    KConfig * config = KGlobal::config();
+    config->setDesktopGroup();
+    setDefaultSession(config->readEntry("DefaultSession","shell.desktop"));
+  }
   return m_defaultSession;
 }
 
@@ -2878,8 +2870,8 @@
   // If you add any new signal-slot connection below, think about doing it in konsolePart too
   connect( s,SIGNAL(done(TESession*)),
            this,SLOT(doneSession(TESession*)) );
-  connect( s, SIGNAL( updateTitle() ),
-           this, SLOT( updateTitle() ) );
+  connect( s, SIGNAL( updateTitle(TESession*) ),
+           this, SLOT( updateTitle(TESession*) ) );
   connect( s, SIGNAL( notifySessionState(TESession*, int) ),
            this, SLOT( notifySessionState(TESession*, int)) );
   connect( s, SIGNAL(disableMasterModeConnections()),
@@ -3118,12 +3110,17 @@
   ra->unplug(m_view);
   ra->plug(m_view,(m_view->count()-sessions.count()+1)+position-1);
 
+  QColor oldcolor = tabwidget->tabColor(se->widget());
+  
   tabwidget->blockSignals(true);
   tabwidget->removePage(se->widget());
   tabwidget->blockSignals(false);
-  createSessionTab(se->widget(), iconSetForSession(se), se->Title(), position-1);
+  QString title = se->Title();
+  createSessionTab(se->widget(), iconSetForSession(se), 
+                   title.replace('&', "&&"), position-1);
   tabwidget->showPage(se->widget());
-
+  tabwidget->setTabColor(se->widget(),oldcolor);
+  
   if (!m_menuCreated)
     makeGUI();
   m_moveSessionLeft->setEnabled(position-1>0);
@@ -3146,12 +3143,17 @@
   ra->unplug(m_view);
   ra->plug(m_view,(m_view->count()-sessions.count()+1)+position+1);
 
+  QColor oldcolor = tabwidget->tabColor(se->widget());
+  
   tabwidget->blockSignals(true);
   tabwidget->removePage(se->widget());
   tabwidget->blockSignals(false);
-  createSessionTab(se->widget(), iconSetForSession(se), se->Title(), position+1);
+  QString title = se->Title();
+  createSessionTab(se->widget(), iconSetForSession(se), 
+                   title.replace('&', "&&"), position+1);
   tabwidget->showPage(se->widget());
-
+  tabwidget->setTabColor(se->widget(),oldcolor);
+  
   if (!m_menuCreated)
     makeGUI();
   m_moveSessionLeft->setEnabled(true);
@@ -3398,6 +3400,14 @@
 
 void Konsole::createSessionMenus()
 {
+  if (no2command.isEmpty()) { // All sessions have been deleted
+    m_session->insertItem(SmallIconSet("window_new"),
+                          i18n("New &Window"), SESSION_NEW_WINDOW_ID);
+    m_tabbarSessionsCommands->insertItem(SmallIconSet("window_new"),
+                          i18n("New &Window"), SESSION_NEW_WINDOW_ID);
+    return;
+  }
+
   KSimpleConfig *cfg = no2command[SESSION_NEW_SHELL_ID];
   QString txt = cfg->readEntry("Name");
   QString icon = cfg->readEntry("Icon", "konsole");
@@ -3552,6 +3562,7 @@
   if (s) setSchema(s);
 }
 
+// Called via main.cpp for session manager.
 void Konsole::setEncoding(int index)
 {
   if ( selectSetEncoding ) {
@@ -3645,7 +3656,7 @@
   disconnect( _se->getEmulation(),SIGNAL(changeColumns(int)), this,SLOT(changeColumns(int)) );
   disconnect( _se, SIGNAL(changeTabTextColor(TESession*, int)), this, SLOT(changeTabTextColor(TESession*, int)) );
 
-  disconnect( _se,SIGNAL(updateTitle()), this,SLOT(updateTitle()) );
+  disconnect( _se,SIGNAL(updateTitle(TESession*)), this,SLOT(updateTitle(TESession*)) );
   disconnect( _se,SIGNAL(notifySessionState(TESession*,int)), this,SLOT(notifySessionState(TESession*,int)) );
   disconnect( _se,SIGNAL(disableMasterModeConnections()), this,SLOT(disableMasterModeConnections()) );
   disconnect( _se,SIGNAL(enableMasterModeConnections()), this,SLOT(enableMasterModeConnections()) );
@@ -3661,6 +3672,7 @@
   konsole->attachSession(_se);
   konsole->activateSession(_se);
   konsole->changeTabTextColor( _se, se_tabtextcolor.rgb() );//restore prev color
+  konsole->slotTabSetViewOptions(m_tabViewMode);
 
   if (_se==se) {
     if (se == se_previous)
@@ -3734,7 +3746,7 @@
   connect( session,SIGNAL(done(TESession*)),
            this,SLOT(doneSession(TESession*)) );
 
-  connect( session,SIGNAL(updateTitle()), this,SLOT(updateTitle()) );
+  connect( session,SIGNAL(updateTitle(TESession*)), this,SLOT(updateTitle(TESession*)) );
   connect( session,SIGNAL(notifySessionState(TESession*,int)), this,SLOT(notifySessionState(TESession*,int)) );
 
   connect( session,SIGNAL(disableMasterModeConnections()), this,SLOT(disableMasterModeConnections()) );
diff -Nur kdebase-3.5.2/konsole.orig/konsole/konsole.h kdebase-3.5.2/konsole/konsole/konsole.h
--- kdebase-3.5.2/konsole.orig/konsole/konsole.h	2006-03-17 11:17:43.000000000 +0100
+++ kdebase-3.5.2/konsole/konsole/konsole.h	2006-05-23 17:59:30.000000000 +0200
@@ -163,7 +163,7 @@
   void changeColLin(int columns, int lines);
   void notifySessionState(TESession* session,int state);
   void notifySize(int columns, int lines);
-  void updateTitle();
+  void updateTitle(TESession* _se=0);
   void prevSession();
   void nextSession();
   void activateMenu();
diff -Nur kdebase-3.5.2/konsole.orig/konsole/kwrited.cpp kdebase-3.5.2/konsole/konsole/kwrited.cpp
--- kdebase-3.5.2/konsole.orig/konsole/kwrited.cpp	2005-09-10 10:26:07.000000000 +0200
+++ kdebase-3.5.2/konsole/konsole/kwrited.cpp	2006-05-23 17:59:30.000000000 +0200
@@ -39,14 +39,19 @@
      see ../Makefile.am - kwrited doesn't seem to work well without utempter
 */
 
-KWrited::KWrited() : QObject()
+KWrited::KWrited() : QTextEdit()
 {
-  wid = new QTextEdit(0, "messages");
-  wid->setFont(KGlobalSettings::fixedFont());
-  wid->setMinimumWidth(wid->fontMetrics().maxWidth()*80 +
-      wid->minimumSizeHint().width());
-  wid->setReadOnly(true);
-  wid->setFocusPolicy(QWidget::NoFocus);
+  int pref_width, pref_height;
+
+  setFont(KGlobalSettings::fixedFont());
+  pref_width = (2 * KGlobalSettings::desktopGeometry(0).width()) / 3;
+  pref_height = fontMetrics().lineSpacing() * 10;
+  setMinimumWidth(pref_width);
+  setMinimumHeight(pref_height);
+  setReadOnly(true);
+  setFocusPolicy(QWidget::NoFocus);
+  setWordWrap(QTextEdit::WidgetWidth);
+  setTextFormat(Qt::PlainText);
 
   pty = new KPty();
   pty->open();
@@ -55,7 +60,7 @@
   connect(sn, SIGNAL(activated(int)), this, SLOT(block_in(int)));
 
   QString txt = i18n("KWrited - Listening on Device %1").arg(pty->ttyName());
-  wid->setCaption(txt);
+  setCaption(txt);
   puts(txt.local8Bit().data());
 }
 
@@ -72,9 +77,25 @@
   if (len <= 0)
      return;
 
-  wid->insert( QString::fromLocal8Bit( buf, len ).remove('\r') );
-  wid->show();
-  wid->raise();
+  insert( QString::fromLocal8Bit( buf, len ).remove('\r') );
+  show();
+  raise();
+}
+
+void KWrited::clearText()
+{
+   clear();
+}
+
+QPopupMenu *KWrited::createPopupMenu( const QPoint &pos )
+{
+   QPopupMenu *menu = QTextEdit::createPopupMenu( pos );
+
+   menu->insertItem( i18n( "Clear Messages" ),
+                     this, SLOT( clearText() ), 
+                     0, -1, 0 );
+
+   return menu;
 }
 
 KWritedModule::KWritedModule( const QCString& obj )
diff -Nur kdebase-3.5.2/konsole.orig/konsole/kwrited.h kdebase-3.5.2/konsole/konsole/kwrited.h
--- kdebase-3.5.2/konsole.orig/konsole/kwrited.h	2005-09-10 10:26:08.000000000 +0200
+++ kdebase-3.5.2/konsole/konsole/kwrited.h	2006-05-23 17:59:30.000000000 +0200
@@ -3,16 +3,21 @@
 
 #include <qtextedit.h>
 #include <kdedmodule.h>
+#include <qpopupmenu.h>
+#include <qtextedit.h>
 
 class KPty;
 
-class KWrited : public QObject
+class KWrited : public QTextEdit
 { Q_OBJECT
 public:
   KWrited();
  ~KWrited();
+protected:
+  virtual QPopupMenu *createPopupMenu(const QPoint &);
 private slots:
   void block_in(int fd);
+  void clearText(void);
 private:
   QTextEdit* wid;
   KPty* pty;
diff -Nur kdebase-3.5.2/konsole.orig/konsole/session.cpp kdebase-3.5.2/konsole/konsole/session.cpp
--- kdebase-3.5.2/konsole.orig/konsole/session.cpp	2005-09-10 10:26:07.000000000 +0200
+++ kdebase-3.5.2/konsole/konsole/session.cpp	2006-05-23 17:59:30.000000000 +0200
@@ -7,6 +7,9 @@
 #include <knotifyclient.h>
 #include <klocale.h>
 #include <kprocio.h>
+#include <krun.h>
+#include <kshell.h>
+#include <kstandarddirs.h>
 
 #include <stdlib.h>
 #include <qfile.h>
@@ -146,8 +149,18 @@
 
 void TESession::run()
 {
-//  kdDebug(1211) << "Running the session!" << pgm << "\n";
-  //pgm = "pine";
+  // Upon a KPty error, there is no description on what that error was...
+  // Check to see if the given program is executable.
+  QString exec = QFile::encodeName(pgm);
+  exec = KRun::binaryName(exec, false);
+  exec = KShell::tildeExpand(exec);
+  QString pexec = KGlobal::dirs()->findExe(exec);
+  if ( pexec.isEmpty() ) {
+    kdError()<<"can not execute "<<exec<<endl;
+    QTimer::singleShot(1, this, SLOT(done()));
+    return;
+  }
+
   QString appId=kapp->dcopClient()->appId();
 
   QString cwd_save = QDir::currentDirPath();
@@ -207,7 +220,7 @@
        te->update();
     }
 
-    emit updateTitle();
+    emit updateTitle(this);
 }
 
 QString TESession::fullTitle() const
@@ -335,7 +348,7 @@
   if (!autoClose)
   {
     userTitle = i18n("<Finished>");
-    emit updateTitle();
+    emit updateTitle(this);
     return;
   }
   if (!wantedClose && (exitStatus || sh->signalled()))
diff -Nur kdebase-3.5.2/konsole.orig/konsole/session.h kdebase-3.5.2/konsole/konsole/session.h
--- kdebase-3.5.2/konsole.orig/konsole/session.h	2005-09-10 10:26:08.000000000 +0200
+++ kdebase-3.5.2/konsole/konsole/session.h	2006-05-23 17:59:30.000000000 +0200
@@ -139,7 +139,7 @@
   void forkedChild();
   void receivedData( const QString& text );
   void done(TESession*);
-  void updateTitle();
+  void updateTitle(TESession*);
   void notifySessionState(TESession* session, int state);
   void changeTabTextColor( TESession*, int );
 
diff -Nur kdebase-3.5.2/konsole.orig/konsole/TEmuVt102.cpp kdebase-3.5.2/konsole/konsole/TEmuVt102.cpp
--- kdebase-3.5.2/konsole.orig/konsole/TEmuVt102.cpp	2005-09-10 10:26:07.000000000 +0200
+++ kdebase-3.5.2/konsole/konsole/TEmuVt102.cpp	2006-05-23 17:59:30.000000000 +0200
@@ -1345,8 +1345,10 @@
     int scrolllock_mask = 0;
     XModifierKeymap* map = XGetModifierMapping( qt_xdisplay() );
     KeyCode scrolllock_keycode = XKeysymToKeycode( qt_xdisplay(), XK_Scroll_Lock );
-    if( scrolllock_keycode == NoSymbol )
+    if( scrolllock_keycode == NoSymbol ) {
+        XFreeModifiermap(map);
         return 0;
+    }
     for( int i = 0;
          i < 8;
          ++i )
@@ -1355,6 +1357,7 @@
                scrolllock_mask += 1 << i;
        }
 
+    XFreeModifiermap(map);
     return scrolllock_mask;
 }
 #endif
diff -Nur kdebase-3.5.2/konsole.orig/konsole/TEScreen.cpp kdebase-3.5.2/konsole/konsole/TEScreen.cpp
--- kdebase-3.5.2/konsole.orig/konsole/TEScreen.cpp	2006-03-17 11:17:43.000000000 +0100
+++ kdebase-3.5.2/konsole/konsole/TEScreen.cpp	2006-05-23 17:59:30.000000000 +0200
@@ -275,6 +275,7 @@
 void TEScreen::deleteChars(int n)
 {
   if (n == 0) n = 1; // Default
+  if (n > columns) n = columns - 1;
   int p = QMAX(0,QMIN(cuX+n,columns-1));
   moveImage(loc(cuX,cuY),loc(p,cuY),loc(columns-1,cuY));
   clearImage(loc(columns-n,cuY),loc(columns-1,cuY),' ');




More information about the fedora-cvs-commits mailing list