~ben-kietzman/ubuntu/quantal/mountmanager/fix-for-598070

« back to all changes in this revision

Viewing changes to sources/gui/infobutton.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Fabrice Coutadeur
  • Date: 2008-08-20 10:22:14 UTC
  • Revision ID: james.westby@ubuntu.com-20080820102214-fv93myu0ncb1503r
Tags: upstream-0.2.4
ImportĀ upstreamĀ versionĀ 0.2.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//MountManager - the program for easy mounting of storage devices in Linux
 
2
//Copyright (C) 2007-2008 Tikhonov Sergey
 
3
//
 
4
//This file is part of MountManager Gui
 
5
//
 
6
//This program is free software; you can redistribute it and/or
 
7
//modify it under the terms of the GNU General Public License
 
8
//as published by the Free Software Foundation; either version 2
 
9
//of the License, or (at your option) any later version.
 
10
//
 
11
//This program is distributed in the hope that it will be useful,
 
12
//but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
//GNU General Public License for more details.
 
15
//
 
16
//You should have received a copy of the GNU General Public License
 
17
//along with this program; if not, write to the Free Software
 
18
//Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
19
#include "infobutton.h"
 
20
#include "const.h"
 
21
#include "popupwindow.h"
 
22
 
 
23
InfoButton::InfoButton(PopupWindow *popup,const QString& text, const QString& header) {
 
24
        setIcon(QIcon(QString(ICONS_PATH) + "info.png"));
 
25
        setFlat(true);
 
26
        popupWindow = popup;
 
27
        popupText = text;
 
28
        popupHeader = header;
 
29
        connect(this,SIGNAL(clicked()),this,SLOT(setPopupData()));
 
30
}
 
31
 
 
32
void InfoButton::setPopupText(const QString& text) {
 
33
        popupText = text;
 
34
}
 
35
 
 
36
void InfoButton::setPopupHeaderText(const QString& header) {
 
37
        popupHeader = header;
 
38
}
 
39
 
 
40
void InfoButton::setPopupData() {
 
41
        if (popupText.isEmpty())
 
42
                popupWindow->setText(tr("Cannot find documentation for it. Try to install new version of MountManager or report about it to developer."));
 
43
        else
 
44
                popupWindow->setText(popupText);
 
45
        if (popupHeader.isEmpty())
 
46
                popupWindow->setHeaderText(tr("Popup window"));
 
47
        else
 
48
                popupWindow->setHeaderText(popupHeader);
 
49
        popupWindow->showPopup();
 
50
}