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

krdc

  • sources
  • kde-4.12
  • kdenetwork
  • krdc
  • nx
nxresumesessions.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2008 David Gross <gdavid.devel@gmail.com>
4 **
5 ** This file is part of KDE.
6 **
7 ** This program is free software; you can redistribute it and/or modify
8 ** it under the terms of the GNU General Public License as published by
9 ** the Free Software Foundation; either version 2 of the License, or
10 ** (at your option) any later version.
11 **
12 ** This program is distributed in the hope that it will be useful,
13 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ** GNU General Public License for more details.
16 **
17 ** You should have received a copy of the GNU General Public License
18 ** along with this program; see the file COPYING. If not, write to
19 ** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 ** Boston, MA 02110-1301, USA.
21 **
22 ****************************************************************************/
23 
24 #include "nxresumesessions.h"
25 
26 #include <QTreeWidget>
27 #include <QTreeWidgetItem>
28 #include <QVBoxLayout>
29 
30 #include <KTitleWidget>
31 
32 NxResumeSessions::NxResumeSessions()
33 {
34  QWidget *nxPage = new QWidget();
35  nxUi.setupUi(nxPage);
36 
37  setCaption(i18n("Available NX Sessions"));
38  setButtons(KDialog::None);
39 
40  QVBoxLayout *layout = new QVBoxLayout();
41 
42  KTitleWidget *titleWidget = new KTitleWidget();
43  titleWidget->setText(i18n("Available NX Sessions"));
44  titleWidget->setPixmap(KIcon("krdc"));
45  layout->addWidget(titleWidget);
46  layout->addWidget(nxPage);
47 
48  QWidget *mainWidget = new QWidget();
49  mainWidget->setLayout(layout);
50  setMainWidget(mainWidget);
51 
52  connect(nxUi.buttonNew, SIGNAL(pressed()), this, SLOT(pressedNew()));
53  connect(nxUi.buttonResume, SIGNAL(pressed()), this, SLOT(pressedResume()));
54 }
55 
56 NxResumeSessions::~NxResumeSessions()
57 {
58  if (!empty())
59  clear();
60 }
61 
62 bool NxResumeSessions::empty() const
63 {
64  return nxUi.sessionsList->topLevelItemCount() == 0;
65 }
66 
67 void NxResumeSessions::clear()
68 {
69  nxUi.sessionsList->clear();
70 }
71 
72 void NxResumeSessions::addSessions(QList<nxcl::NXResumeData> sessions)
73 {
74  for (int i = 0; i < sessions.size(); ++i) {
75  const nxcl::NXResumeData session = sessions.at(i);
76  QTreeWidgetItem *tmp = new QTreeWidgetItem();
77  tmp->setText(0, QString::number(session.display));
78  tmp->setText(1, QString(session.sessionType.c_str()));
79  tmp->setText(2, QString(session.sessionID.c_str()));
80  tmp->setText(3, QString::number(session.depth));
81  tmp->setText(4, QString(session.screen.c_str()));
82  tmp->setText(5, QString(session.sessionName.c_str()));
83 
84  nxUi.sessionsList->addTopLevelItem(tmp);
85  }
86 }
87 
88 void NxResumeSessions::show()
89 {
90  adjustSize();
91 
92  if (exec() == KDialog::Rejected)
93  pressedNew();
94 }
95 
96 void NxResumeSessions::pressedNew()
97 {
98  emit newSession();
99 }
100 
101 void NxResumeSessions::pressedResume()
102 {
103  emit resumeSession(QString(""));
104 }
105 
QWidget
NxResumeSessions::resumeSession
void resumeSession(QString)
NxResumeSessions::clear
void clear()
Definition: nxresumesessions.cpp:67
NxResumeSessions::empty
bool empty() const
Definition: nxresumesessions.cpp:62
nxresumesessions.h
NxResumeSessions::~NxResumeSessions
~NxResumeSessions()
Definition: nxresumesessions.cpp:56
NxResumeSessions::addSessions
void addSessions(QList< nxcl::NXResumeData > sessions)
Definition: nxresumesessions.cpp:72
NxResumeSessions::newSession
void newSession()
NxResumeSessions::NxResumeSessions
NxResumeSessions()
Definition: nxresumesessions.cpp:32
NxResumeSessions::show
void show()
Definition: nxresumesessions.cpp:88
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:54:04 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

krdc

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

kdenetwork API Reference

Skip menu "kdenetwork API Reference"
  • kget
  • kopete
  •   kopete
  •   libkopete
  • krdc
  • krfb

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