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

List:       kde-commits
Subject:    kdelibs/kio/misc
From:       Per Winkvist <per.winkvist () uk ! com>
Date:       2003-11-06 14:54:05
[Download RAW message or body]

CVS commit by winkvist: 


- Fix bug 59910 (Show network operations in single window only works once)
- Fix bug where listitems got removed when changing settings


  M +37 -35    uiserver.cpp   1.103
  M +0 -2      uiserver.h   1.60


--- kdelibs/kio/misc/uiserver.cpp  #1.102:1.103
@@ -484,22 +484,37 @@ ListProgress::~ListProgress() {
 void ListProgress::applySettings()
 {
-   //remove all but the first column
-   for (int i=columns()-1; i>=0; i--)
-      removeColumn(i);
+  int iEnabledCols=0;
 
+  // Update listcolumns to show
    for (int i=0; i<TB_MAX; i++)
    {
-//      kdDebug()<<"createColumn() i: "<<i<<" width: "<<m_lpcc[i].width<<endl;
-      if (m_lpcc[i].enabled)
-      {
+    if ( !m_lpcc[i].enabled )
+      continue;
+
+    iEnabledCols++;
+    
+    // Add new or reuse existing column
+    if ( iEnabledCols > columns() )
          m_lpcc[i].index=addColumn(m_lpcc[i].title, m_fixedColumnWidths?m_lpcc[i].width:-1);
-         setColumnWidth(i, m_lpcc[i].width); //yes, this is required here, alexxx
-         if (m_fixedColumnWidths)
-            setColumnWidthMode(i, Manual);
+    else
+    {
+      m_lpcc[i].index = iEnabledCols - 1;
+      setColumnText(m_lpcc[i].index, m_lpcc[i].title);
       }
-//      else
-//         m_lpcc[i].index=-1;
+    
+    setColumnWidth(m_lpcc[i].index, m_lpcc[i].width); //yes, this is required here, alexxx
+    if (m_fixedColumnWidths)
+        setColumnWidthMode(m_lpcc[i].index, Manual);
    }
-  if (!m_showHeader)
+
+  // Remove unused columns. However we must keep one column left
+  // Otherwise the listview will be emptied
+  while( iEnabledCols < columns() && columns() > 1 )
+     removeColumn( columns() - 1 );
+
+  if ( columns() == 0 )
+    addColumn( "" );
+
+  if ( !m_showHeader || iEnabledCols == 0 )
      header()->hide();
   else
@@ -1187,5 +1203,5 @@ KSSLCertDlgRet UIServer::showSSLCertDial
    if (!certList.isEmpty()) {
       KSSLCertDlg *kcd = new KSSLCertDlg(0L, 0L, true);
-      kcd->setup(certList);
+      kcd->setupDialog(certList);
       kcd->setHost(host);
       kdDebug(7024) << "Showing SSL certificate dialog" << endl;
@@ -1309,18 +1325,4 @@ void UIServer::resizeEvent(QResizeEvent*
    KMainWindow::resizeEvent(e);
    writeSettings();
-}
-
-void UIServer::showEvent(QShowEvent* e)
-{
-  KMainWindow::showEvent(e);
-  m_bShowList=true;
-  writeSettings();
-}
-
-void UIServer::hideEvent(QHideEvent* e)
-{
-  KMainWindow::hideEvent(e);
-  m_bShowList=false;
-  writeSettings();
 }
 

--- kdelibs/kio/misc/uiserver.h  #1.59:1.60
@@ -376,6 +376,4 @@ protected:
 
   virtual void resizeEvent(QResizeEvent* e);
-  virtual void showEvent(QShowEvent*);
-  virtual void hideEvent(QHideEvent*);
   virtual bool queryClose();
 


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

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