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

List:       kwrite-devel
Subject:    [Kwrite-devel] Bug#35812: Problem solved - patch attached
From:       Maciek Borowka <Maciej.BOROWKA () ifaedi ! insa-lyon ! fr>
Date:       2001-12-05 21:36:01
[Download RAW message or body]

Hello,
I am following a good-user-approach : signal the problem, analyse it and send 
the patch to the maintanier... So, it is high time to the 'patch' part...

I changed four files:
filelist/katefilelist.cpp 
main/kwritemain.cpp 
mainwindow/katemainwindow.cpp 
view/kateviewmanager.cpp 

I set the limit to filename (or "prettyURL") to 200 caracters. If the file 
name is longer, the most left length() - 200 bytes is cut off and a "..." is 
added. In the case of url, the same thing is done on the right side, just to 
keep the path complete.
I just hope I didn't screw up anything else ;+)

Cheers,
/Maciek

["longnames.patch" (text/x-diff)]

diff -r -C 5 kate.new/filelist/katefilelist.cpp kate.patched/filelist/katefilelist.cpp
*** kate.new/filelist/katefilelist.cpp	Wed Dec  5 22:09:54 2001
--- kate.patched/filelist/katefilelist.cpp	Wed Dec  5 22:13:19 2001
***************
*** 124,139 ****
  
    for (uint i = 0; i < count(); i++)
    {
      if (((KateFileListItem *) item (i)) ->docID() == doc->docID())
      {
!       //File name shouldn't be too long - Maciek
!       QString c = doc -> docName();
!       if (c.length() > 200)
!         c = "..." + c.right(197);
! 
!       ((KateFileListItem *)item(i))->setText(c);
        triggerUpdate(false);
        break;
      }
    }
  }
--- 124,134 ----
  
    for (uint i = 0; i < count(); i++)
    {
      if (((KateFileListItem *) item (i)) ->docID() == doc->docID())
      {
!       ((KateFileListItem *)item(i))->setText(doc->docName());
        triggerUpdate(false);
        break;
      }
    }
  }
diff -r -C 5 kate.new/main/kwritemain.cpp kate.patched/main/kwritemain.cpp
*** kate.new/main/kwritemain.cpp	Wed Dec  5 22:12:29 2001
--- kate.patched/main/kwritemain.cpp	Wed Dec  5 22:13:19 2001
***************
*** 300,325 ****
    if (kateView->doc()->url().isEmpty()) {
      setCaption(i18n("Untitled"),kateView->isModified());
    } else {
      //set caption
      if ( m_paShowPath->isChecked() )
!     {
!       //File name shouldn't be too long - Maciek
!       if (kateView->doc()->url().filename().length() > 200)
!         setCaption(kateView->doc()->url().prettyURL().left(197) + "...",kateView->isModified());
!       else
!         setCaption(kateView->doc()->url().prettyURL(),kateView->isModified());
!     }
      else
!     {
!       //File name shouldn't be too long - Maciek
!       if (kateView->doc()->url().filename().length() > 200)
!         setCaption("..." + kateView->doc()->url().fileName().right(197),kateView->isModified());
!       else
!         setCaption(kateView->doc()->url().fileName(),kateView->isModified());
! 
!     }
    }
  }
  
  void TopLevel::dragEnterEvent( QDragEnterEvent *event )
  {
--- 300,312 ----
    if (kateView->doc()->url().isEmpty()) {
      setCaption(i18n("Untitled"),kateView->isModified());
    } else {
      //set caption
      if ( m_paShowPath->isChecked() )
!       setCaption(kateView->doc()->url().prettyURL(),kateView->isModified());
      else
!       setCaption(kateView->doc()->url().fileName(),kateView->isModified());
    }
  }
  
  void TopLevel::dragEnterEvent( QDragEnterEvent *event )
  {
diff -r -C 5 kate.new/mainwindow/katemainwindow.cpp kate.patched/mainwindow/katemainwindow.cpp
*** kate.new/mainwindow/katemainwindow.cpp	Wed Dec  5 22:11:15 2001
--- kate.patched/mainwindow/katemainwindow.cpp	Wed Dec  5 22:13:19 2001
***************
*** 482,498 ****
  
    QString entry;
    while ( z<docManager->docCount() )
    {
      if ( (!docManager->nthDoc(z)->url().isEmpty()) && (docManager->nthDoc(z)->url().filename() != 0) )
!     {
!       //File name shouldn't be too long - Maciek
!       if (docManager->nthDoc(z)->url().filename().length() > 200)
!         entry=QString("&%1 ").arg(i)+"..."+(docManager->nthDoc(z)->url().filename()).right(197);
!       else
!         entry=QString("&%1 ").arg(i)+docManager->nthDoc(z)->url().filename();
!     }
      else
        entry=QString("&%1 ").arg(i)+i18n("Untitled %1").arg(docManager->nthDoc(z)->docID());
  
      if (docManager->nthDoc(z)->isModified())
        entry.append (i18n(" - Modified"));
--- 482,492 ----
  
    QString entry;
    while ( z<docManager->docCount() )
    {
      if ( (!docManager->nthDoc(z)->url().isEmpty()) && (docManager->nthDoc(z)->url().filename() != 0) )
!       entry=QString("&%1 ").arg(i)+docManager->nthDoc(z)->url().filename();
      else
        entry=QString("&%1 ").arg(i)+i18n("Untitled %1").arg(docManager->nthDoc(z)->docID());
  
      if (docManager->nthDoc(z)->isModified())
        entry.append (i18n(" - Modified"));
diff -r -C 5 kate.new/view/kateviewmanager.cpp kate.patched/view/kateviewmanager.cpp
*** kate.new/view/kateviewmanager.cpp	Wed Dec  5 22:13:03 2001
--- kate.patched/view/kateviewmanager.cpp	Wed Dec  5 22:13:19 2001
***************
*** 390,405 ****
      }
    }
  
    int mod = (int)v->isModified();
  
!   QString c = v -> doc()->docName();
!   //File name shouldn't be too long - Maciek
!   if (c.length() > 200)
!     c = "..." + c.right(197);
! 
!   emit statusChanged (v, v->currentLine() + 1, v->currentColumn() + 1, ovr, mod, c);
    emit statChanged ();
  }
  
  void KateViewManager::slotWindowNext()
  {
--- 390,400 ----
      }
    }
  
    int mod = (int)v->isModified();
  
!   emit statusChanged (v, v->currentLine() + 1, v->currentColumn() + 1, ovr, mod, v->doc()->docName());
    emit statChanged ();
  }
  
  void KateViewManager::slotWindowNext()
  {
***************
*** 912,934 ****
  {
    if (activeView())
    {
      QString c;
      if (activeView()->doc()->url().isEmpty() || (! showFullPath))
-     {
        c = ((KateDocument *)activeView()->doc())->docName();
-       //File name shouldn't be too long - Maciek
-       if (c.length() > 200)
-         c = "..." + c.right(197);
-     }
      else
-     {
        c = activeView()->doc()->url().prettyURL();
-       //File name shouldn't be too long - Maciek
-       if (c.length() > 200)
-         c = c.left(197) + "...";
-     }
  
      ((KateMainWindow*)topLevelWidget())->setCaption( c,activeView()->isModified());
    }
  }
  
--- 907,919 ----

_______________________________________________
kwrite-devel mailing list
kwrite-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/kwrite-devel


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

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