summaryrefslogtreecommitdiffstats
path: root/kjots/KJotsMain.h
blob: 132e10efee63955f6dda10923731aa4030b66739 (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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
//
//  kjots
//
//  Copyright (C) 1997 Christoph Neerfeld
//  Copyright (C) 2002-2004 Aaron J. Seigo
//  Copyright (C) 2003 Stanislav Kljuhhin
//
//  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.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
//

#ifndef KJotsMain_included
#define KJotsMain_included

#include <tqlayout.h>
#include <tqpushbutton.h>

#include <kdialogbase.h>
#include <kmainwindow.h>

class TQGroupBox;
class TQWidgetStack;
class KTextBrowser;
class KAccel;
class KJotsMain;
class KToolBar;
class KListBox;
class KListView;
class KPopupMenu;
class ConfigureDialog;
class KEdFind;
class KEdReplace;
class TQTimer;
class KAction;
class KActionMenu;

class KJotsPage;
class KJotsBook;
class KJotsEntryBase;
class KJotsEdit;

//
// KJotsMain
//
#define ACTION_NEXT_BOOK 0
#define ACTION_PREV_BOOK 1
#define ACTION_NEXT_PAGE 2
#define ACTION_PREV_PAGE 3
#define ACTION_NEW_PAGE 4
#define ACTION_NEW_BOOK 5
#define ACTION_PAGE2TEXT 6
#define ACTION_PAGE2HTML 7
#define ACTION_BOOK2TEXT 8
#define ACTION_BOOK2HTML 9
#define ACTION_DELETE_PAGE 10
#define ACTION_DELETE_BOOK 11
#define ACTION_MANUAL_SAVE 12
#define ACTION_PRINT 13
#define ACTION_TQUIT 14
#define ACTION_CUT 15
#define ACTION_COPY 16
#define ACTION_PASTE2TITLE 17
#define ACTION_PASTE 18
#define ACTION_FIND 19
#define ACTION_FIND_NEXT 20
#define ACTION_REPLACE 21
#define ACTION_RENAME 22
#define ACTION_INSERT_DATE 23
#define ACTION_MAX 24

class KJotsMain : public KMainWindow
{
    Q_OBJECT
  

    public:
        KJotsMain( const char* name = 0 );

        TQString currentBookmarkTitle();
        TQString currentBookmarkURL();

    public:
        void updateCaption();

    protected slots:
        void slotSetupInterface();
        bool createNewBook();
        void deleteBook();
        void newEntry();
        void deleteEntry();
        void slotRenameEntry();
        void configure();
        void updateConfiguration();

        void copySelection();
        void insertDate();
        void slotPrint();
        void slotSearch();
        void slotRepeatSearch();
        void slotReplace();
        void slotQuit();
        void slotFindSuccessful();

        void jumpToEntry(TQListViewItem* entry, bool=false);

        void slotExpandBook(TQListViewItem* item);
        void slotCollapseBook(TQListViewItem* item);
        void slotItemRenamed(TQListViewItem*,const TQString&,int);
        void slotItemMoved(TQListViewItem*,TQListViewItem*,TQListViewItem*);
        void writeBook();
        void writeBookToHTML();
        void saveBookToFile(bool plainText);
        void writePage();
        void writePageToHTML();
        void savePageToFile(bool plainText);

        void nextBook();
        void prevBook();
        void nextPage();
        void prevPage();

        // handling page changes in the listview
        void showListviewContextMenu(KListView* l, TQListViewItem* i, const TQPoint& p);
        void linkClicked(const TQString&);
        void autoSave(void);

        // bookmarks
        void jumpToBookmark(const TQString& page);

    protected:
        void saveProperties();
        bool queryClose();
        void updateMenu();
        void loadBooks();
        KJotsBook* currentBook();
        KJotsPage* currentPage();

        TQHBoxLayout   *bg_top_layout;
        TQButtonGroup  *bg_top;
        KJotsEdit   *me_text;
        KTextBrowser *roTextView;
        KListView     *subjectList;
        KJotsEntryBase *currentEntry;
        TQSplitter *splitter;
        TQWidgetStack *textStack;
        TQFont m_font;
        TQTimer*  m_autosaveTimer;
        bool invalidMoveFlag; //!< Used to fix a race condition. See Bug #109299

        KAction* actions[ACTION_MAX];
        KActionMenu *exportPageMenu, *exportBookMenu, *bookmarkMenu;
};

#endif // KJotsMain_included
/* ex: set tabstop=4 softtabstop=4 shiftwidth=4 expandtab: */