Some more bugfixes for the tag feature:

- Don't crash when updating the toolbar icons
- deprecated--
- Replace some tabs with spaces
- In the toolbar and the quick search combobox, show the tag name without any prefixes because of the lack of space there
- Actually load the tag actions when KMail starts up
- Fix the toggled state of the actions, it was not updated properly
- Preselect the action category when choosing a tag icon

svn path=/trunk/KDE/kdepim/; revision=693689
wilder-work
Thomas McGuire 19 years ago
parent 3c760f56de
commit 6e6fa394af
  1. 2
      configuredialog.cpp
  2. 7
      headerlistquicksearch.cpp
  3. 25
      kmmainwidget.cpp
  4. 5
      kmmessagetag.cpp
  5. 20
      kmmessagetag.h

@ -2424,7 +2424,7 @@ AppearancePageMessageTagTab::AppearancePageMessageTagTab( QWidget * parent )
//Fourth for toolbar icon
mIconButton = new KIconButton( mTagSettingGroupBox );
mIconButton->setIconSize( 16 );
mIconButton->setIconType( K3Icon::NoGroup, K3Icon::Any, true );
mIconButton->setIconType( K3Icon::NoGroup, K3Icon::Action );
settings->addWidget( mIconButton, 5, 1 );
QLabel *iconlabel = new QLabel( i18n("Message Tag &Icon"),

@ -151,7 +151,7 @@ bool HeaderListQuickSearch::itemMatches(const Q3ListViewItem *item, const QStrin
KMHeaders *headers = static_cast<KMHeaders*>( item->listView() );
const KMMsgBase *msg = headers->getMsgBaseForItem( item );
if ( !msg || !msg->tagList()
|| msg->tagList()->find( mTagLabel ) == msg->tagList()->end() )
|| msg->tagList()->indexOf( mTagLabel ) == -1 )
return false;
}
return K3ListViewSearchLine::itemMatches(item, s);
@ -188,9 +188,8 @@ void HeaderListQuickSearch::updateComboList()
= kmkernel->msgTagMgr()->msgTagList();
for ( QList<KMMessageTagDescription *>::ConstIterator it = msgTagList->begin();
it != msgTagList->end(); ++it ) {
QString lineString = i18n("Tagged %1", (*it)->name() );
mStatusCombo->insertItem( SmallIcon( (*it)->toolbarIconName() ),
lineString );
QString lineString = (*it)->name();
mStatusCombo->addItem( SmallIcon( (*it)->toolbarIconName() ), lineString );
}
mStatusCombo->setCurrentIndex( 0 );
mFilterWithTag = false;

@ -3794,6 +3794,9 @@ void KMMainWidget::slotShowStartupFolder()
// plug folder shortcut actions
initializeFolderShortcutActions();
// plug tag actions now
initializeMessageTagActions();
QString newFeaturesMD5 = KMReaderWin::newFeaturesMD5();
if ( kmkernel->firstStart() ||
GlobalSettings::self()->previousNewFeaturesMD5() != newFeaturesMD5 ) {
@ -3832,7 +3835,7 @@ void KMMainWidget::updateMessageTagActions( const int count )
bool list_present = false;
if ( aTagList )
list_present =
( aTagList->indexOf( QString((*it).second->name() ) ) != -1 );
( aTagList->indexOf( QString((*it).first->label() ) ) != -1 );
aToggler = static_cast<KToggleAction*>( (*it).second );
aToggler->setChecked( list_present );
}
@ -3861,18 +3864,24 @@ void KMMainWidget::slotUpdateMessageTagList( const QString &name )
void KMMainWidget::clearMessageTagActions()
{
//Remove the tag actions from the toolbar
if ( !mMessageTagTBarActions.isEmpty() ) {
qDeleteAll(mMessageTagTBarActions);
mMessageTagTBarActions.clear();
if ( mGUIClient->factory() )
mGUIClient->unplugActionList( "toolbar_messagetag_actions" );
mMessageTagTBarActions.clear();
}
//Remove the tag actions from the status menu and the action collection,
//then delete them.
for ( QList<MessageTagPtrPair>::ConstIterator it =
mMessageTagMenuActions.constBegin();
it != mMessageTagMenuActions.constEnd(); ++it ) {
mStatusMenu->removeAction( (*it).second );
delete (*it).second;
} //Do this way, since there are other elements in the menu
// This removes and deletes the action at the same time
actionCollection()->removeAction( (*it).second );
}
mMessageTagMenuActions.clear();
delete mMessageTagToggleMapper;
mMessageTagToggleMapper = 0;
@ -3903,13 +3912,15 @@ void KMMainWidget::initializeMessageTagActions()
if ( ! it.value() || it.value()->isEmpty() )
continue;
QString cleanName = i18n("Message Tag %1", it.value()->name() );
QString iconText = QString( "%1" ).arg( it.value()->name() );
cleanName.replace("&","&&");
tagAction = new KToggleAction( KIcon(it.value()->toolbarIconName()),
cleanName, this );
tagAction->setShortcut( it.value()->shortcut() );
tagAction->setIconText( iconText );
actionCollection()->addAction(it.value()->label().toLocal8Bit(), tagAction);
connect(tagAction, SIGNAL(triggered(bool)), mMessageTagToggleMapper, SLOT(map(void)));
//The shortcut configuration is done in the config. dialog
//The shortcut configuration is done in the config dialog.
//Setting the below to true decouples action objects shortcut
//from that of the tag description
tagAction->setShortcutConfigurable( false );
@ -3918,7 +3929,7 @@ void KMMainWidget::initializeMessageTagActions()
//Relies on the fact that filters are always numbered from 0
mMessageTagMenuActions[it.value()->priority()] = ptr_pair;
}
for ( int i= 0; i < numTags; ++i ) {
for ( int i=0; i < numTags; ++i ) {
mStatusMenu->menu()->addAction( mMessageTagMenuActions[i].second );
if ( ( mMessageTagMenuActions[i].first )->inToolbar() )
mMessageTagTBarActions.append( mMessageTagMenuActions[i].second );

@ -278,7 +278,7 @@ void KMMessageTagMgr::writeConfig( bool withSync )
//first, delete all groups:
QStringList tagGroups
= config->groupList().grep( QRegExp( "MessageTag #\\d+" ) );
= config->groupList().filter( QRegExp( "MessageTag #\\d+" ) );
for ( QStringList::Iterator it = tagGroups.begin();
it != tagGroups.end(); ++it )
config->deleteGroup( *it );
@ -324,6 +324,7 @@ bool KMMessageTagList::compareTags( const QString &lhs, const QString &rhs)
void KMMessageTagList::prioritySort()
{
//BLA
//Use bubble sort for now
int n = size();
if ( !n )
@ -345,7 +346,7 @@ void KMMessageTagList::prioritySort()
const KMMessageTagList KMMessageTagList::split( const QString &aSep,
const QString &aStr )
{
return KMMessageTagList( QStringList::split( aSep, aStr ) );
return KMMessageTagList( aStr.split( aSep, QString::SkipEmptyParts ) );
}
//----------------------------EO KMMessageTagList----------------------------------

@ -145,20 +145,20 @@ class KMMessageTagMgr : public QObject
name). Returns 0 if not found.
@param aLabel 10 letter label to be searched for in the dictionary
*/
const KMMessageTagDescription *find( const QString &aLabel ) const;
const KMMessageTagDescription *find( const QString &aLabel ) const;
/**Returns a pointer to the dictionary itself. Used to iterate over all
tags. Shouldn't be used to modify tags.*/
const QHash<QString, KMMessageTagDescription*> *msgTagDict(void) const { return mTagDict; }
tags. Shouldn't be used to modify tags.*/
const QHash<QString, KMMessageTagDescription*> *msgTagDict(void) const { return mTagDict; }
/**Returns a pointer to the priority ordered list*/
const QList<KMMessageTagDescription *> *msgTagList(void) const { return mTagList; }
/** @return @c true if the tags are modified after the initial config read*/
bool isDirty( void ) const { return mDirty; }
bool isDirty( void ) const { return mDirty; }
/**Fills the tag dictionary from the given pointer list @p aTagList . The
dictionary is cleared first, so @p aTagList should be a complete set of tags
ordered in decreasing priority. The tag descriptions that @p aTagList points to
are copied, so it is safe to delete them afterwards.
@param aTagList Pointer list that contains a full set of tags and is
priority ordered*/
dictionary is cleared first, so @p aTagList should be a complete set of
tags ordered in decreasing priority. The tag descriptions that @p aTagList
points to are copied, so it is safe to delete them afterwards.
@param aTagList Pointer list that contains a full set of tags and is
priority ordered*/
void fillTagsFromList( const QList<KMMessageTagDescription*> *aTagList );
signals:
@ -168,7 +168,7 @@ are copied, so it is safe to delete them afterwards.
private:
//This function shouldn't be public since it doesn't emit msgTagListChanged
void clear(void);
void addTag( KMMessageTagDescription *aDesc, bool emitChange = true );
QHash<QString,KMMessageTagDescription*> *mTagDict;

Loading…
Cancel
Save