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

List:       kde-commits
Subject:    [Konversation] 3cbfed7: Make the automatic-resizing only happen when
From:       Max Howell <max.howell () methylblue ! com>
Date:       2010-07-01 13:27:30
Message-ID: 20100701132730.3ED1ABB5622 () projects ! kde ! org
[Download RAW message or body]

commit 3cbfed7215895f8be61aab47dcdddda8b546e060
Author: Max Howell <max.howell@methylblue.com>
Date:   Mon Jun 14 03:19:18 2004 +0000

    Make the automatic-resizing only happen when the hostname column isn't shown, as \
that one is pretty wide. I would say make that one resize with QListView width too, \
but it can be very wide and I think users should be able to scroll horizontally to \
see the hostnames.  
    svn path=/trunk/kdeextragear-2/konversation/; revision=320448

diff --git a/konversation/channel.cpp b/konversation/channel.cpp
index d466975..1b18a81 100644
--- a/konversation/channel.cpp
+++ b/konversation/channel.cpp
@@ -266,7 +266,7 @@ Channel::Channel(QWidget* parent) : ChatWindow(parent)
   // every few seconds try to get more userhosts
   autoUserhostChanged(KonversationApplication::preferences.getAutoUserhost());
   userhostTimer.start(10000);
-  
+
   m_allowNotifications = true;
 }
 
@@ -527,7 +527,7 @@ void Channel::completeNick()
       { // Shell like completion
         QStringList found;
         foundNick = nicknameList.completeNick(pattern, complete, found);
-        
+
         if(!complete && !found.isEmpty()) {
           if(KonversationApplication::preferences.getNickCompletionMode() == 1) {
             QString nicks = found.join(" ");
@@ -538,7 +538,7 @@ void Channel::completeNick()
         }
       } else if(KonversationApplication::preferences.getNickCompletionMode() == 0) { \
// Cycle completion  complete = true;
-        
+
         do
         {
           QString lookNick=nicknameList.at(completionPosition)->getNickname();
@@ -551,7 +551,7 @@ void Channel::completeNick()
           // first search position
         } while(completionPosition!=oldCompletionPosition && foundNick.isEmpty());
       }
-      
+
       // did we find a suitable nick?
       if(!foundNick.isEmpty())
       {
@@ -1647,6 +1647,13 @@ void Channel::autoUserhostChanged(bool state)
 {
   if(state)
   {
+    // we can't have automatic resizing with three columns; the hostname column is \
too wide +    nicknameListView->setResizeMode(QListView::NoColumn);
+    // shrink the first column and let it re-expand, otherwise it stays
+    // maximum width, leaving the hostmask column off the screen
+    nicknameListView->setColumnWidth(1,32);
+    nicknameListView->setColumnWidthMode(1,KListView::Maximum);
+
     // restart userhost timer
     userhostTimer.start(10000);
     // if the column was actually gone (just to be sure) ...
@@ -1669,6 +1676,9 @@ void Channel::autoUserhostChanged(bool state)
   {
     userhostTimer.stop();
     if(nicknameListView->columns()==3) nicknameListView->removeColumn(2);
+
+    // make the nick column resize itself automatically to prevent horizontal \
scrollbar +    nicknameListView->setResizeMode(QListView::LastColumn);
   }
 }
 
@@ -1714,11 +1724,11 @@ QString NickList::completeNick(const QString& pattern, bool& \
complete, QStringLi  {
   found.clear();
   QString prefix = "^";
-  
+
   if(pattern.find(QRegExp("^(\\d|\\w)")) != -1) {
     prefix = "(^|[^\\d\\w]|[\\_])";
   }
-  
+
   QRegExp regexp(prefix + QRegExp::escape(pattern.lower()));
 
   for(Nick* n = first(); n; n = next()) {
@@ -1739,14 +1749,14 @@ QString NickList::completeNick(const QString& pattern, bool& \
complete, QStringLi  i -= 1;
       }
     }
-      
+
     complete = false;
     return found[0].left(pattern.length() + i);
   } else if(found.count() == 1) {
     complete = true;
     return found[0];
   }
-  
+
   return QString::null;
 }
 
diff --git a/konversation/nicklistview.cpp b/konversation/nicklistview.cpp
index 08140e7..9281ea8 100644
--- a/konversation/nicklistview.cpp
+++ b/konversation/nicklistview.cpp
@@ -22,8 +22,6 @@
 NickListView::NickListView(QWidget* parent) :
               KListView(parent)
 {
-  setResizeMode(QListView::LastColumn);
-
   popup=new QPopupMenu(this,"nicklist_context_menu");
   modes=new QPopupMenu(this,"nicklist_modes_context_submenu");
   kickban=new QPopupMenu(this,"nicklist_kick_ban_context_submenu");


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

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