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

List:       kde-devel
Subject:    Changes in kapp
From:       Espen Sand <espensa () online ! no>
Date:       1999-09-19 9:32:42
[Download RAW message or body]

Last Friday I asked if anybody had objections to that I added a new method to
kapp.cc/h. I have got no such replies. I send this message again just to make
sure. I will add the code today sometime between 1800 and 2000 CET unless 
someone think this is really bad.

The purpose it to make a method that will make a correct caption. If this
method is used everywhere, all apps + dialogs will get the same caption.

Usage: "setCaption(kapp->makeStdCaption(caption))" . In my view it is not the 
application programmer that should decide the layout of the caption.

what I will add: 

kapp.h
-----
enum captionStyle
{
  CaptionAppLast=0, // "caption - <appName>"
  CaptionAppFirst,    // "<appName>: caption"
  CaptionNoApp       // "caption"
};

int mCaptionStyle;    // Set to CaptionAppLast in constructor.
QString makeStdCaption( const QString &userCaption, bool withAppName=true )
const;

kapp.cc
------

QString KApplication::makeStdCaption( const QString &userCaption, bool
withAppName ) const 
{
  if( userCaption.isNull() == true )
  {
    return( getCaption() );
  }
 
  if( withAppName == true )
  {
    if( mCaptionStyle == CaptionAppLast )
    {
      return( QString("%1 - %2").arg(userCaption).arg(getCaption()));
    }
    else if( mCaptionStyle == CaptionAppFirst )
    {
      return( QString("%1: %2").arg(getCaption()).arg(userCaption) );
    }
  }
  
  return( userCaption );
}


Still to be considered
---------------
A signal telling that the layout has changed.



-- 
Espen Sand

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

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