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

kwallet

  • sources
  • kde-4.14
  • kdeutils
  • kwalletmanager
  • src
  • manager
authorizedapplicationstable.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2013 Valentin Rusu <kde@rusu.info>
3 
4  This program is free software; you can redistribute it and/or
5  modify it under the terms of the GNU General Public
6  License as published by the Free Software Foundation; either
7  version 2 of the License, or (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; see the file COPYING. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 
20 #include "authorizedapplicationstable.h"
21 #include "authorizedappmodel.h"
22 #include "revokeauthbutton.h"
23 
24 AuthorizedApplicationsTable::AuthorizedApplicationsTable(QWidget* parent) :
25  QTableView(parent),
26  _wallet(0)
27 {
28 }
29 
30 void AuthorizedApplicationsTable::setWallet(KWallet::Wallet* wallet)
31 {
32  _wallet = wallet;
33 }
34 
35 void AuthorizedApplicationsTable::setModel(QAbstractItemModel* model)
36 {
37  Q_ASSERT(_wallet != 0);
38 
39  AuthorizedAppModel *appModel = qobject_cast<AuthorizedAppModel*>(model);
40  Q_ASSERT(appModel != 0);
41 
42  QTableView::setModel(model);
43  for (int row =0; row < model->rowCount(); row++) {
44  RevokeAuthButton *btn = new RevokeAuthButton( model->index(row, 0).data().toString() , _wallet);
45  btn->setFixedHeight(btn->sizeHint().height());
46  setRowHeight(row, btn->height());
47  setIndexWidget( model->index(row, 1), btn);
48  connect(btn, SIGNAL(appRevoked(QString)), appModel, SLOT(removeApp(QString)));
49  }
50 }
51 
52 void AuthorizedApplicationsTable::resizeEvent(QResizeEvent* resizeEvent)
53 {
54  // this will keep disconnect buttons column at it's minimum size and
55  // make the application names take the reminder of the horizontal space
56  resizeColumnsToContents();
57  int appColumnSize = contentsRect().width() - columnWidth(1) - 50;
58  setColumnWidth(0, appColumnSize);
59  QAbstractItemView::resizeEvent(resizeEvent);
60 }
61 
62 #include "authorizedapplicationstable.moc"
QTableView::setColumnWidth
void setColumnWidth(int column, int width)
QResizeEvent
QWidget
QAbstractItemModel::rowCount
virtual int rowCount(const QModelIndex &parent) const =0
QAbstractItemModel::index
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const =0
AuthorizedApplicationsTable::resizeEvent
virtual void resizeEvent(QResizeEvent *resizeEvent)
Definition: authorizedapplicationstable.cpp:52
QPushButton::sizeHint
virtual QSize sizeHint() const
authorizedapplicationstable.h
QTableView::resizeColumnsToContents
void resizeColumnsToContents()
QWidget::contentsRect
QRect contentsRect() const
QAbstractItemView::resizeEvent
virtual void resizeEvent(QResizeEvent *event)
QTableView::setRowHeight
void setRowHeight(int row, int height)
QTableView::setModel
virtual void setModel(QAbstractItemModel *model)
AuthorizedApplicationsTable::setWallet
void setWallet(KWallet::Wallet *wallet)
Definition: authorizedapplicationstable.cpp:30
QTableView::columnWidth
int columnWidth(int column) const
QString
AuthorizedApplicationsTable::AuthorizedApplicationsTable
AuthorizedApplicationsTable(QWidget *parent)
Definition: authorizedapplicationstable.cpp:24
QTableView
AuthorizedAppModel
Definition: authorizedappmodel.h:30
QRect::width
int width() const
QModelIndex::data
QVariant data(int role) const
QWidget::setFixedHeight
void setFixedHeight(int h)
AuthorizedApplicationsTable::setModel
virtual void setModel(QAbstractItemModel *model)
Definition: authorizedapplicationstable.cpp:35
QSize::height
int height() const
QAbstractItemView::setIndexWidget
void setIndexWidget(const QModelIndex &index, QWidget *widget)
authorizedappmodel.h
QAbstractItemModel
QAbstractItemView::model
QAbstractItemModel * model() const
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QVariant::toString
QString toString() const
revokeauthbutton.h
QWidget::height
height
RevokeAuthButton
Definition: revokeauthbutton.h:29
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:42:01 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kwallet

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

kdeutils API Reference

Skip menu "kdeutils API Reference"
  • ark
  • filelight
  • kcalc
  • kcharselect
  • kdf
  • kfloppy
  • kgpg
  • ktimer
  • kwallet
  • sweeper

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