-rw-r--r-- | kmicromail/viewmailbase.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/kmicromail/viewmailbase.cpp b/kmicromail/viewmailbase.cpp index 3bb964e..371ee91 100644 --- a/kmicromail/viewmailbase.cpp +++ b/kmicromail/viewmailbase.cpp | |||
@@ -1,109 +1,112 @@ | |||
1 | // CHANGED 2004-08-06 Lutz Rogowski | 1 | // CHANGED 2004-08-06 Lutz Rogowski |
2 | #include <qtextbrowser.h> | 2 | #include <q3textbrowser.h> |
3 | #include <qlistview.h> | 3 | #include <q3listview.h> |
4 | #include <qaction.h> | 4 | #include <qaction.h> |
5 | #include <qlabel.h> | 5 | #include <qlabel.h> |
6 | #include <qvbox.h> | 6 | #include <q3vbox.h> |
7 | #include <qapplication.h> | 7 | #include <qapplication.h> |
8 | 8 | ||
9 | #include <qtoolbar.h> | 9 | #include <q3toolbar.h> |
10 | #include <qmenubar.h> | 10 | #include <qmenubar.h> |
11 | //Added by qt3to4: | ||
12 | #include <QKeyEvent> | ||
13 | #include <Q3PopupMenu> | ||
11 | #include <kiconloader.h> | 14 | #include <kiconloader.h> |
12 | //#include <qpe/resource.h> | 15 | //#include <qpe/resource.h> |
13 | #include <klocale.h> | 16 | #include <klocale.h> |
14 | 17 | ||
15 | #include "viewmailbase.h" | 18 | #include "viewmailbase.h" |
16 | //#include "opendiag.h" | 19 | //#include "opendiag.h" |
17 | 20 | ||
18 | ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl) | 21 | ViewMailBase::ViewMailBase(QWidget *parent, const char *name, Qt::WFlags fl) |
19 | : QMainWindow(parent, name, fl) | 22 | : Q3MainWindow(parent, name, fl) |
20 | { | 23 | { |
21 | 24 | ||
22 | setToolBarsMovable(false); | 25 | setToolBarsMovable(false); |
23 | 26 | ||
24 | toolbar = new QToolBar(this); | 27 | toolbar = new Q3ToolBar(this); |
25 | menubar = new QMenuBar( toolbar ); | 28 | menubar = new QMenuBar( toolbar ); |
26 | mailmenu = new QPopupMenu( menubar ); | 29 | mailmenu = new Q3PopupMenu( menubar ); |
27 | menubar->insertItem( i18n( "Mail" ), mailmenu ); | 30 | menubar->insertItem( i18n( "Mail" ), mailmenu ); |
28 | 31 | ||
29 | toolbar->setHorizontalStretchable(true); | 32 | toolbar->setHorizontalStretchable(true); |
30 | addToolBar(toolbar); | 33 | addToolBar(toolbar); |
31 | 34 | ||
32 | viewSource = new QAction(i18n("View Source"), 0, 0, this); | 35 | viewSource = new QAction(i18n("View Source"), 0, 0, this); |
33 | viewSource->addTo(mailmenu); | 36 | viewSource->addTo(mailmenu); |
34 | 37 | ||
35 | downloadMail= new QAction(i18n("Download Mail"),SmallIcon("add"), 0, 0, this); | 38 | downloadMail= new QAction(i18n("Download Mail"),SmallIcon("add"), 0, 0, this); |
36 | downloadMail->addTo(toolbar); | 39 | downloadMail->addTo(toolbar); |
37 | downloadMail->addTo(mailmenu); | 40 | downloadMail->addTo(mailmenu); |
38 | 41 | ||
39 | 42 | ||
40 | reply = new QAction(i18n("Reply"),SmallIcon("reply"), 0, 0, this); | 43 | reply = new QAction(i18n("Reply"),SmallIcon("reply"), 0, 0, this); |
41 | reply->addTo(toolbar); | 44 | reply->addTo(toolbar); |
42 | reply->addTo(mailmenu); | 45 | reply->addTo(mailmenu); |
43 | 46 | ||
44 | forward = new QAction(i18n("Forward"),SmallIcon("forward"), 0, 0, this); | 47 | forward = new QAction(i18n("Forward"),SmallIcon("forward"), 0, 0, this); |
45 | forward->addTo(toolbar); | 48 | forward->addTo(toolbar); |
46 | forward->addTo(mailmenu); | 49 | forward->addTo(mailmenu); |
47 | 50 | ||
48 | attachbutton = new QAction(i18n("Attachments"),SmallIcon("attach"), 0, 0, this, 0, true); | 51 | attachbutton = new QAction(i18n("Attachments"),SmallIcon("attach"), 0, 0, this, 0, true); |
49 | attachbutton->addTo(toolbar); | 52 | attachbutton->addTo(toolbar); |
50 | attachbutton->addTo(mailmenu); | 53 | attachbutton->addTo(mailmenu); |
51 | connect(attachbutton, SIGNAL(toggled(bool)), SLOT(slotChangeAttachview(bool))); | 54 | connect(attachbutton, SIGNAL(toggled(bool)), SLOT(slotChangeAttachview(bool))); |
52 | 55 | ||
53 | showHtml = new QAction( i18n( "Show Html" ), SmallIcon( "html" ), 0, 0, this, 0, true ); | 56 | showHtml = new QAction( i18n( "Show Html" ), SmallIcon( "html" ), 0, 0, this, 0, true ); |
54 | showHtml->addTo( toolbar ); | 57 | showHtml->addTo( toolbar ); |
55 | showHtml->addTo( mailmenu ); | 58 | showHtml->addTo( mailmenu ); |
56 | 59 | ||
57 | deleteMail = new QAction(i18n("Delete Mail"),SmallIcon("trash"), 0, 0, this); | 60 | deleteMail = new QAction(i18n("Delete Mail"),SmallIcon("trash"), 0, 0, this); |
58 | deleteMail->addTo(toolbar); | 61 | deleteMail->addTo(toolbar); |
59 | deleteMail->addTo(mailmenu); | 62 | deleteMail->addTo(mailmenu); |
60 | 63 | ||
61 | nextMail = new QAction(i18n("Show next mail"),SmallIcon("enter"), 0, 0, this); | 64 | nextMail = new QAction(i18n("Show next mail"),SmallIcon("enter"), 0, 0, this); |
62 | QLabel *spacer = new QLabel(toolbar); | 65 | QLabel *spacer = new QLabel(toolbar); |
63 | nextMail->addTo(toolbar); | 66 | nextMail->addTo(toolbar); |
64 | nextMail->addTo(mailmenu); | 67 | nextMail->addTo(mailmenu); |
65 | 68 | ||
66 | closeMail = new QAction(i18n("Close"),SmallIcon("exit"), 0, 0, this); | 69 | closeMail = new QAction(i18n("Close"),SmallIcon("exit"), 0, 0, this); |
67 | //QLabel *spacer = new QLabel(toolbar); | 70 | //QLabel *spacer = new QLabel(toolbar); |
68 | spacer->setBackgroundMode(QWidget::PaletteButton); | 71 | spacer->setBackgroundMode(QWidget::PaletteButton); |
69 | toolbar->setStretchableWidget(spacer); | 72 | toolbar->setStretchableWidget(spacer); |
70 | closeMail->addTo(toolbar); | 73 | closeMail->addTo(toolbar); |
71 | closeMail->addTo(mailmenu); | 74 | closeMail->addTo(mailmenu); |
72 | QVBox *view = new QVBox(this); | 75 | Q3VBox *view = new Q3VBox(this); |
73 | setCentralWidget(view); | 76 | setCentralWidget(view); |
74 | 77 | ||
75 | attachments = new QListView(view); | 78 | attachments = new Q3ListView(view); |
76 | int fixh = 100; | 79 | int fixh = 100; |
77 | if ( QApplication::desktop()->width() > 320 ) | 80 | if ( QApplication::desktop()->width() > 320 ) |
78 | fixh = 200; | 81 | fixh = 200; |
79 | attachments->setFixedHeight(fixh); | 82 | attachments->setFixedHeight(fixh); |
80 | attachments->setAllColumnsShowFocus(true); | 83 | attachments->setAllColumnsShowFocus(true); |
81 | attachments->addColumn("Mime Type", fixh-30); | 84 | attachments->addColumn("Mime Type", fixh-30); |
82 | attachments->addColumn(i18n("Description"), 100); | 85 | attachments->addColumn(i18n("Description"), 100); |
83 | attachments->addColumn(i18n("Filename"), 80); | 86 | attachments->addColumn(i18n("Filename"), 80); |
84 | attachments->addColumn(i18n("Size"), 80); | 87 | attachments->addColumn(i18n("Size"), 80); |
85 | attachments->setSorting(-1); | 88 | attachments->setSorting(-1); |
86 | attachments->hide(); | 89 | attachments->hide(); |
87 | 90 | ||
88 | browser = new QTextBrowser(view); | 91 | browser = new Q3TextBrowser(view); |
89 | 92 | ||
90 | //openDiag = new OpenDiag(view); | 93 | //openDiag = new OpenDiag(view); |
91 | //openDiag->hide(); | 94 | //openDiag->hide(); |
92 | 95 | ||
93 | } | 96 | } |
94 | 97 | ||
95 | void ViewMailBase::slotChangeAttachview(bool state) | 98 | void ViewMailBase::slotChangeAttachview(bool state) |
96 | { | 99 | { |
97 | if (state) attachments->show(); | 100 | if (state) attachments->show(); |
98 | else attachments->hide(); | 101 | else attachments->hide(); |
99 | } | 102 | } |
100 | 103 | ||
101 | void ViewMailBase::keyPressEvent ( QKeyEvent * e ) | 104 | void ViewMailBase::keyPressEvent ( QKeyEvent * e ) |
102 | { | 105 | { |
103 | if( e->key()==Qt::Key_Escape ) { | 106 | if( e->key()==Qt::Key_Escape ) { |
104 | close(); | 107 | close(); |
105 | e->accept(); | 108 | e->accept(); |
106 | return; | 109 | return; |
107 | } | 110 | } |
108 | QWidget::keyPressEvent(e); | 111 | QWidget::keyPressEvent(e); |
109 | } | 112 | } |