~ubuntu-branches/ubuntu/intrepid/kdesdk/intrepid-updates

« back to all changes in this revision

Viewing changes to kuiviewer/kuiviewer.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2008-05-28 10:11:43 UTC
  • mto: This revision was merged to the branch mainline in revision 37.
  • Revision ID: james.westby@ubuntu.com-20080528101143-gzc3styjz1b70zxu
Tags: upstream-4.0.80
ImportĀ upstreamĀ versionĀ 4.0.80

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 *
17
17
 *  You should have received a copy of the GNU Library General Public License
18
18
 *  along with this library; see the file COPYING.LIB.  If not, write to
19
 
 *  the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20
 
 *  Boston, MA 02111-1307, USA.
 
19
 *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
20
 *  Boston, MA 02110-1301, USA.
21
21
 **/
22
22
 
23
23
#include "kuiviewer.h"
26
26
 
27
27
#include <kdebug.h>
28
28
 
29
 
#include <qobjectlist.h>
30
 
#include <qdockwindow.h>
 
29
#include <qobject.h>
31
30
#include <qpixmap.h>
32
31
 
33
32
#include <kurl.h>
34
33
 
35
34
#include <kaction.h>
36
 
#include <kstdaction.h>
 
35
#include <kactioncollection.h>
 
36
#include <kstandardaction.h>
37
37
 
38
38
#include <kiconloader.h>
39
39
#include <klibloader.h>
42
42
#include <kfiledialog.h>
43
43
 
44
44
KUIViewer::KUIViewer()
45
 
    : KParts::MainWindow( 0L, "KUIViewer" )
 
45
    : KParts::MainWindow()
46
46
{
 
47
    setObjectName( "KUIViewer" );
47
48
    // setup our actions
48
49
    setupActions();
49
50
 
61
62
        // now that the Part is loaded, we cast it to a Part to get
62
63
        // our hands on it
63
64
        m_part = static_cast<KParts::ReadOnlyPart *>(factory->create(this,
64
 
                                "kuiviewer_part", "KParts::ReadOnlyPart" ));
 
65
                                                     "KParts::ReadOnlyPart" ));
65
66
 
66
67
        if (m_part)
67
68
        {
 
69
            m_part->setObjectName( "kuiviewer_part" );
68
70
            // tell the KParts::MainWindow that this is indeed the main widget
69
71
            setCentralWidget(m_part->widget());
70
72
 
89
91
{
90
92
}
91
93
 
92
 
void KUIViewer::load(const KURL& url)
 
94
void KUIViewer::load(const KUrl& url)
93
95
{
94
 
    m_part->openURL( url );
 
96
    m_part->openUrl( url );
95
97
    adjustSize();
96
98
}
97
99
 
98
100
void KUIViewer::setupActions()
99
101
{
100
 
    KStdAction::open(this, SLOT(fileOpen()), actionCollection());
101
 
    KStdAction::quit(kapp, SLOT(quit()), actionCollection());
102
 
}
103
 
 
104
 
void KUIViewer::saveProperties(KConfig* /*config*/)
105
 
{
106
 
    // the 'config' object points to the session managed
107
 
    // config file.  anything you write here will be available
108
 
    // later when this app is restored
109
 
}
110
 
 
111
 
void KUIViewer::readProperties(KConfig* /*config*/)
112
 
{
113
 
    // the 'config' object points to the session managed
114
 
    // config file.  this function is automatically called whenever
115
 
    // the app is being restored.  read in here whatever you wrote
116
 
    // in 'saveProperties'
 
102
    KStandardAction::open(this, SLOT(fileOpen()), actionCollection());
 
103
    KStandardAction::quit(kapp, SLOT(quit()), actionCollection());
117
104
}
118
105
 
119
106
void KUIViewer::fileOpen()
121
108
    // this slot is called whenever the File->Open menu is selected,
122
109
    // the Open shortcut is pressed (usually CTRL+O) or the Open toolbar
123
110
    // button is clicked
124
 
    KURL file_name =
125
 
        KFileDialog::getOpenURL( QString::null, i18n("*.ui *.UI|User Interface Files"), this );
 
111
    KUrl file_name =
 
112
        KFileDialog::getOpenUrl( KUrl(), i18n("*.ui *.UI|User Interface Files"), this );
126
113
 
127
114
    if (file_name.isEmpty() == false)
128
115
    {
145
132
    }
146
133
}
147
134
 
148
 
void KUIViewer::takeScreenshot(const QCString &filename, int w, int h){
 
135
void KUIViewer::takeScreenshot(const QByteArray &filename, int w, int h){
149
136
    if(!m_part)
150
137
        return;
151
138
    showMinimized();