• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

kmail

  • sources
  • kde-4.12
  • kdepim
  • kmail
  • configuredialog
configuredialoglistview.cpp
Go to the documentation of this file.
1 /* -*- mode: C++; c-file-style: "gnu" -*-
2  * kmail: KDE mail client
3  */
4 
5 #include "configuredialoglistview.h"
6 
7 #include <KLocale>
8 #include <KMenu>
9 
10 ListView::ListView( QWidget *parent )
11  : QTreeWidget( parent )
12 {
13  setAllColumnsShowFocus( true );
14  setAlternatingRowColors( true );
15  setSelectionMode( QAbstractItemView::SingleSelection );
16  setRootIsDecorated( false );
17  setContextMenuPolicy( Qt::CustomContextMenu );
18  connect( this, SIGNAL(customContextMenuRequested(QPoint)), SLOT(slotContextMenu(QPoint)) );
19 }
20 
21 
22 void ListView::resizeEvent( QResizeEvent *e )
23 {
24  QTreeWidget::resizeEvent(e);
25  resizeColums();
26 }
27 
28 void ListView::showEvent( QShowEvent *e )
29 {
30  QTreeWidget::showEvent(e);
31  resizeColums();
32 }
33 
34 
35 void ListView::resizeColums()
36 {
37  const int c = columnCount();
38  if( c == 0 ) {
39  return;
40  }
41 
42  const int w1 = viewport()->width();
43  const int w2 = w1 / c;
44  const int w3 = w1 - (c-1)*w2;
45 
46  for ( int i=0; i<c-1; ++i ) {
47  setColumnWidth( i, w2 );
48  }
49  setColumnWidth( c-1, w3 );
50 }
51 
52 void ListView::slotContextMenu(const QPoint& pos)
53 {
54  KMenu *menu = new KMenu( this );
55  menu->addAction( i18n("Add"), this, SIGNAL(addHeader()));
56  if (currentItem()) {
57  menu->addAction( i18n("Remove"), this, SIGNAL(removeHeader()));
58  }
59  menu->exec( viewport()->mapToGlobal( pos ) );
60  delete menu;
61 }
62 
63 #include "configuredialoglistview.moc"
QTreeWidget
ListView::showEvent
void showEvent(QShowEvent *e)
Definition: configuredialoglistview.cpp:28
configuredialoglistview.h
QWidget
ListView::ListView
ListView(QWidget *parent=0)
Definition: configuredialoglistview.cpp:10
ListView::addHeader
void addHeader()
ListView::removeHeader
void removeHeader()
ListView::resizeEvent
void resizeEvent(QResizeEvent *e)
Definition: configuredialoglistview.cpp:22
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:58:51 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kmail

Skip menu "kmail"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal