blob: 5d07fa40f003eefb94ee3cf47a9c66935dc8e8bc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
/*
**************************************************************************
description
--------------------
copyright : (C) 2002 by Luis Carvalho
email : lpassos@mail.telepac.pt
**************************************************************************
**************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
**************************************************************************/
#ifndef PMLIBRARYOBJECTPREVIEW_H
#define PMLIBRARYOBJECTPREVIEW_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <tqwidget.h>
#include <tqimage.h>
#include <kurl.h>
class TQLabel;
class TQLineEdit;
class TQMultiLineEdit;
class TQPushButton;
class TQFrame;
class PMPart;
class PMTreeView;
/**
* Preview widget for Library Objects and sub Libs.
*/
class PMLibraryEntryPreview: public TQWidget
{
TQ_OBJECT
public:
/** Constructor */
PMLibraryEntryPreview( TQWidget *parent );
/** Destructor */
~PMLibraryEntryPreview( );
/**
* Called to show the file preview.
* @param url The path to the file
* @param readOnly Whether the top library is read only
* @param subLib Whether this is a sub library to preview
* @Return true if the previous file was saved to disk.
*/
bool showPreview( KURL url, bool readOnly, bool subLib );
/**
* Clears the preview
*/
virtual void clearPreview( );
/**
* Save the object, if needed.
* @param forceSave If true don't ask about changes just save them
* @Return true if a save was performed.
*/
bool saveIfNeeded( bool forceSave = false );
signals:
/** Emitted when the object name has been changed */
void objectChanged( );
protected:
virtual void dragEnterEvent( TQDragEnterEvent* event );
virtual void dropEvent( TQDropEvent* event );
private slots:
/** Called when description or keywords are changed */
void slotTextChanged( );
/** Called when the name is changed */
void slotTextChanged( const TQString& s );
/** Called when the set preview button is clicked */
void slotPreviewClicked( );
/** Called when the apply button is clicked */
void slotApplyClicked( );
/** Called when the cancel button is clicked */
void slotCancelClicked( );
private:
/** Called to load the object tree. */
void loadObjects( TQByteArray* obj );
/** Sets whether the object is read only or not */
void setReadOnly( bool b );
/** Sets whether the object is modified or not */
void setModified( bool modified );
PMPart* m_pPart;
TQLineEdit* m_pName;
TQMultiLineEdit* m_pDescription;
TQLabel* m_pKeywordsLabel;
TQMultiLineEdit* m_pKeywords;
TQLabel* m_pContentsLabel;
PMTreeView* m_pContentsPreview;
TQPushButton* m_pSetPreviewImageButton;
TQPushButton* m_pApplyChanges;
TQPushButton* m_pCancelChanges;
TQImage m_image;
KURL m_currentURL;
bool m_modified;
bool m_readOnly;
bool m_subLib;
};
#endif
|