-rw-r--r-- | kmicromail/mainwindow.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp index e020297..2de5b40 100644 --- a/kmicromail/mainwindow.cpp +++ b/kmicromail/mainwindow.cpp | |||
@@ -1,192 +1,194 @@ | |||
1 | |||
2 | // CHANGED 2004-08-06 Lutz Rogowski | ||
1 | #include <qlabel.h> | 3 | #include <qlabel.h> |
2 | #include <qvbox.h> | 4 | #include <qvbox.h> |
3 | #include <qheader.h> | 5 | #include <qheader.h> |
4 | #include <qtimer.h> | 6 | #include <qtimer.h> |
5 | #include <qlayout.h> | 7 | #include <qlayout.h> |
6 | #include <kdialog.h> | 8 | #include <kdialog.h> |
7 | #include <kiconloader.h> | 9 | #include <kiconloader.h> |
8 | #include <kapplication.h> | 10 | #include <kapplication.h> |
9 | 11 | ||
10 | #ifndef DESKTOP_VERSION | 12 | #ifndef DESKTOP_VERSION |
11 | #include <qpe/qpeapplication.h> | 13 | #include <qpe/qpeapplication.h> |
12 | #endif | 14 | #endif |
13 | #include "defines.h" | 15 | #include "defines.h" |
14 | #include "mainwindow.h" | 16 | #include "mainwindow.h" |
15 | #include <KDGanttMinimizeSplitter.h> | 17 | #include <KDGanttMinimizeSplitter.h> |
16 | 18 | ||
17 | 19 | ||
18 | #include <kabc/stdaddressbook.h> | 20 | #include <kabc/stdaddressbook.h> |
19 | 21 | ||
20 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) | 22 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) |
21 | : QMainWindow( parent, name ) //, flags ) | 23 | : QMainWindow( parent, name ) //, flags ) |
22 | { | 24 | { |
23 | setCaption( tr( "OpieMail/Pi" ) ); | 25 | setCaption( tr( "OpieMail/Pi" ) ); |
24 | setToolBarsMovable( false ); | 26 | setToolBarsMovable( false ); |
25 | KABC::StdAddressBook::self(); | 27 | KABC::StdAddressBook::self(); |
26 | toolBar = new QToolBar( this ); | 28 | toolBar = new QToolBar( this ); |
27 | menuBar = new QMenuBar( toolBar ); | 29 | menuBar = new QMenuBar( toolBar ); |
28 | mailMenu = new QPopupMenu( menuBar ); | 30 | mailMenu = new QPopupMenu( menuBar ); |
29 | menuBar->insertItem( tr( "Mail" ), mailMenu ); | 31 | menuBar->insertItem( tr( "Mail" ), mailMenu ); |
30 | settingsMenu = new QPopupMenu( menuBar ); | 32 | settingsMenu = new QPopupMenu( menuBar ); |
31 | menuBar->insertItem( tr( "Settings" ), settingsMenu ); | 33 | menuBar->insertItem( tr( "Settings" ), settingsMenu ); |
32 | 34 | ||
33 | addToolBar( toolBar ); | 35 | addToolBar( toolBar ); |
34 | toolBar->setHorizontalStretchable( true ); | 36 | toolBar->setHorizontalStretchable( true ); |
35 | 37 | ||
36 | 38 | ||
37 | 39 | ||
38 | composeMail = new QAction( tr( "Compose new mail" ), SmallIcon("composemail"), | 40 | composeMail = new QAction( tr( "Compose new mail" ), SmallIcon("composemail"), |
39 | 0, 0, this ); | 41 | 0, 0, this ); |
40 | composeMail->addTo( toolBar ); | 42 | composeMail->addTo( toolBar ); |
41 | composeMail->addTo( mailMenu ); | 43 | composeMail->addTo( mailMenu ); |
42 | 44 | ||
43 | sendQueued = new QAction( tr( "Send queued mails" ), SmallIcon("sendqueued") , | 45 | sendQueued = new QAction( tr( "Send queued mails" ), SmallIcon("sendqueued") , |
44 | 0, 0, this ); | 46 | 0, 0, this ); |
45 | sendQueued->addTo( toolBar ); | 47 | sendQueued->addTo( toolBar ); |
46 | sendQueued->addTo( mailMenu ); | 48 | sendQueued->addTo( mailMenu ); |
47 | 49 | ||
48 | /* | 50 | /* |
49 | syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, | 51 | syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, |
50 | 0, 0, this ); | 52 | 0, 0, this ); |
51 | syncFolders->addTo( toolBar ); | 53 | syncFolders->addTo( toolBar ); |
52 | syncFolders->addTo( mailMenu ); | 54 | syncFolders->addTo( mailMenu ); |
53 | */ | 55 | */ |
54 | 56 | ||
55 | showFolders = new QAction( tr( "Show/Hide folders" ), SmallIcon("showfolders") , | 57 | showFolders = new QAction( tr( "Show/Hide folders" ), SmallIcon("showfolders") , |
56 | 0, 0, this, 0, true ); | 58 | 0, 0, this, 0, true ); |
57 | showFolders->addTo( toolBar ); | 59 | showFolders->addTo( toolBar ); |
58 | showFolders->addTo( mailMenu ); | 60 | showFolders->addTo( mailMenu ); |
59 | showFolders->setOn( true ); | 61 | showFolders->setOn( true ); |
60 | connect(showFolders, SIGNAL( toggled(bool) ), | 62 | connect(showFolders, SIGNAL( toggled(bool) ), |
61 | SLOT( slotShowFolders(bool) ) ); | 63 | SLOT( slotShowFolders(bool) ) ); |
62 | 64 | ||
63 | /* | 65 | /* |
64 | searchMails = new QAction( tr( "Search mails" ), SmallIcon("find") ), | 66 | searchMails = new QAction( tr( "Search mails" ), SmallIcon("find") ), |
65 | 0, 0, this ); | 67 | 0, 0, this ); |
66 | searchMails->addTo( toolBar ); | 68 | searchMails->addTo( toolBar ); |
67 | searchMails->addTo( mailMenu ); | 69 | searchMails->addTo( mailMenu ); |
68 | */ | 70 | */ |
69 | 71 | ||
70 | deleteMails = new QAction(tr("Delete Mail"), SmallIcon("trash"), 0, 0, this); | 72 | deleteMails = new QAction(tr("Delete Mail"), SmallIcon("trash"), 0, 0, this); |
71 | deleteMails->addTo( toolBar ); | 73 | deleteMails->addTo( toolBar ); |
72 | deleteMails->addTo( mailMenu ); | 74 | deleteMails->addTo( mailMenu ); |
73 | connect( deleteMails, SIGNAL( activated() ), | 75 | connect( deleteMails, SIGNAL( activated() ), |
74 | SLOT( slotDeleteMail() ) ); | 76 | SLOT( slotDeleteMail() ) ); |
75 | 77 | ||
76 | editSettings = new QAction( tr( "Edit settings" ), SmallIcon("SettingsIcon") , | 78 | editSettings = new QAction( tr( "Edit settings" ), SmallIcon("SettingsIcon") , |
77 | 0, 0, this ); | 79 | 0, 0, this ); |
78 | editSettings->addTo( settingsMenu ); | 80 | editSettings->addTo( settingsMenu ); |
79 | connect( editSettings, SIGNAL( activated() ), | 81 | connect( editSettings, SIGNAL( activated() ), |
80 | SLOT( slotEditSettings() ) ); | 82 | SLOT( slotEditSettings() ) ); |
81 | editAccounts = new QAction( tr( "Configure accounts" ), SmallIcon("editaccounts") , | 83 | editAccounts = new QAction( tr( "Configure accounts" ), SmallIcon("editaccounts") , |
82 | 0, 0, this ); | 84 | 0, 0, this ); |
83 | editAccounts->addTo( settingsMenu ); | 85 | editAccounts->addTo( settingsMenu ); |
84 | 86 | ||
85 | //setCentralWidget( view ); | 87 | //setCentralWidget( view ); |
86 | 88 | ||
87 | QVBox* wrapperBox = new QVBox( this ); | 89 | QVBox* wrapperBox = new QVBox( this ); |
88 | setCentralWidget( wrapperBox ); | 90 | setCentralWidget( wrapperBox ); |
89 | 91 | ||
90 | // QWidget *view = new QWidget( wrapperBox ); | 92 | // QWidget *view = new QWidget( wrapperBox ); |
91 | KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox); | 93 | KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox); |
92 | split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); | 94 | split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); |
93 | //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight ); | 95 | //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight ); |
94 | 96 | ||
95 | folderView = new AccountView( split ); | 97 | folderView = new AccountView( split ); |
96 | folderView->header()->hide(); | 98 | folderView->header()->hide(); |
97 | folderView->setRootIsDecorated( false ); | 99 | folderView->setRootIsDecorated( false ); |
98 | folderView->addColumn( tr( "Mailbox" ) ); | 100 | folderView->addColumn( tr( "Mailbox" ) ); |
99 | 101 | ||
100 | //layout->addWidget( folderView ); | 102 | //layout->addWidget( folderView ); |
101 | 103 | ||
102 | mailView = new QListView( split ); | 104 | mailView = new QListView( split ); |
103 | mailView->addColumn( tr( " " ) ); | 105 | mailView->addColumn( tr( " " ) ); |
104 | mailView->addColumn( tr( "Subject" ),QListView::Manual ); | 106 | mailView->addColumn( tr( "Subject" ),QListView::Manual ); |
105 | mailView->addColumn( tr( "Sender" ),QListView::Manual ); | 107 | mailView->addColumn( tr( "Sender" ),QListView::Manual ); |
106 | mailView->addColumn( tr( "Size" ),QListView::Manual); | 108 | mailView->addColumn( tr( "Size" ),QListView::Manual); |
107 | mailView->addColumn( tr( "Date" ),QListView::Manual); | 109 | mailView->addColumn( tr( "Date" ),QListView::Manual); |
108 | mailView->setAllColumnsShowFocus(true); | 110 | mailView->setAllColumnsShowFocus(true); |
109 | //mailView->setSorting(-1); | 111 | //mailView->setSorting(-1); |
110 | mailView->setRootIsDecorated( false ); | 112 | mailView->setRootIsDecorated( false ); |
111 | statusWidget = new StatusWidget( wrapperBox ); | 113 | statusWidget = new StatusWidget( wrapperBox ); |
112 | statusWidget->hide(); | 114 | statusWidget->hide(); |
113 | 115 | ||
114 | //layout->addWidget( mailView ); | 116 | //layout->addWidget( mailView ); |
115 | //layout->setStretchFactor( folderView, 1 ); | 117 | //layout->setStretchFactor( folderView, 1 ); |
116 | //layout->setStretchFactor( mailView, 2 ); | 118 | //layout->setStretchFactor( mailView, 2 ); |
117 | 119 | ||
118 | slotAdjustLayout(); | 120 | slotAdjustLayout(); |
119 | #ifndef DESKTOP_VERSION | 121 | #ifndef DESKTOP_VERSION |
120 | QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); | 122 | QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); |
121 | QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); | 123 | QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); |
122 | #endif | 124 | #endif |
123 | connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this, | 125 | connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this, |
124 | SLOT( mailLeftClicked(QListViewItem*) ) ); | 126 | SLOT( mailLeftClicked(QListViewItem*) ) ); |
125 | connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this, | 127 | connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this, |
126 | SLOT( mailLeftClicked(QListViewItem*) ) ); | 128 | SLOT( mailLeftClicked(QListViewItem*) ) ); |
127 | connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, | 129 | connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, |
128 | SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); | 130 | SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); |
129 | connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), | 131 | connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), |
130 | this,SLOT(refreshMailView(const QValueList<RecMailP>&))); | 132 | this,SLOT(refreshMailView(const QValueList<RecMailP>&))); |
131 | connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); | 133 | connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); |
132 | connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); | 134 | connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); |
133 | // connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); | 135 | // connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); |
134 | connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); | 136 | connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); |
135 | //mailView->setMultiSelection ( true ); | 137 | //mailView->setMultiSelection ( true ); |
136 | mailView->setSelectionMode( QListView::Extended ); | 138 | mailView->setSelectionMode( QListView::Extended ); |
137 | QValueList<int> list; | 139 | QValueList<int> list; |
138 | int fw = 100; | 140 | int fw = 100; |
139 | if ( QApplication::desktop()->width() > 320 ) | 141 | if ( QApplication::desktop()->width() > 320 ) |
140 | fw = 50; | 142 | fw = 50; |
141 | list.append( fw ); | 143 | list.append( fw ); |
142 | list.append( 100 ); | 144 | list.append( 100 ); |
143 | split->setSizes( list ); | 145 | split->setSizes( list ); |
144 | QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); | 146 | QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); |
145 | mailView->setShowSortIndicator ( true ); | 147 | mailView->setShowSortIndicator ( true ); |
146 | QLabel *spacer = new QLabel( toolBar ); | 148 | QLabel *spacer = new QLabel( toolBar ); |
147 | spacer->setBackgroundMode( QWidget::PaletteButton ); | 149 | spacer->setBackgroundMode( QWidget::PaletteButton ); |
148 | toolBar->setStretchableWidget( spacer ); | 150 | toolBar->setStretchableWidget( spacer ); |
149 | 151 | ||
150 | QAction* closeMail = new QAction(tr("Close"),SmallIcon("exit"), 0, 0, this); | 152 | QAction* closeMail = new QAction(tr("Close"),SmallIcon("exit"), 0, 0, this); |
151 | connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); | 153 | connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); |
152 | closeMail->addTo(toolBar); | 154 | closeMail->addTo(toolBar); |
153 | closeMail->addTo(mailMenu); | 155 | closeMail->addTo(mailMenu); |
154 | 156 | ||
155 | 157 | ||
156 | QPopupMenu* helpMenu = new QPopupMenu( menuBar ); | 158 | QPopupMenu* helpMenu = new QPopupMenu( menuBar ); |
157 | menuBar->insertItem( tr( "Help" ), helpMenu ); | 159 | menuBar->insertItem( tr( "Help" ), helpMenu ); |
158 | QAction* li = new QAction(tr("About"), QPixmap(), 0, 0, this); | 160 | QAction* li = new QAction(tr("About"), QPixmap(), 0, 0, this); |
159 | connect( li, SIGNAL( activated() ), SLOT( showAbout()) ); | 161 | connect( li, SIGNAL( activated() ), SLOT( showAbout()) ); |
160 | li->addTo(helpMenu); | 162 | li->addTo(helpMenu); |
161 | li = new QAction(tr("Licence"),QPixmap(), 0, 0, this); | 163 | li = new QAction(tr("Licence"),QPixmap(), 0, 0, this); |
162 | connect( li, SIGNAL( activated() ), SLOT( showLicence()) ); | 164 | connect( li, SIGNAL( activated() ), SLOT( showLicence()) ); |
163 | li->addTo(helpMenu); | 165 | li->addTo(helpMenu); |
164 | li = new QAction(tr("LibEtPan Licence"), QPixmap(), 0, 0, this); | 166 | li = new QAction(tr("LibEtPan Licence"), QPixmap(), 0, 0, this); |
165 | connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) ); | 167 | connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) ); |
166 | li->addTo(helpMenu); | 168 | li->addTo(helpMenu); |
167 | } | 169 | } |
168 | 170 | ||
169 | MainWindow::~MainWindow() | 171 | MainWindow::~MainWindow() |
170 | { | 172 | { |
171 | } | 173 | } |
172 | 174 | ||
173 | void MainWindow::showLicence() | 175 | void MainWindow::showLicence() |
174 | { | 176 | { |
175 | KApplication::showLicence(); | 177 | KApplication::showLicence(); |
176 | } | 178 | } |
177 | void MainWindow::showAbout() | 179 | void MainWindow::showAbout() |
178 | { | 180 | { |
179 | QString version; | 181 | QString version; |
180 | #include <../version> | 182 | #include <../version> |
181 | 183 | ||
182 | QString cap = "About KOpieMail/Pi"; | 184 | QString cap = "About KOpieMail/Pi"; |
183 | QString text =i18n("KOpieMail/Platform-independent\n") + | 185 | QString text =i18n("KOpieMail/Platform-independent\n") + |
184 | "(OM/Pi) " + version + " - " | 186 | "(OM/Pi) " + version + " - " |
185 | 187 | ||
186 | #ifdef DESKTOP_VERSION | 188 | #ifdef DESKTOP_VERSION |
187 | "Desktop Edition\n" | 189 | "Desktop Edition\n" |
188 | #else | 190 | #else |
189 | "PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n" | 191 | "PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n" |
190 | #endif | 192 | #endif |
191 | "www.pi-sync.net\n\n" | 193 | "www.pi-sync.net\n\n" |
192 | 194 | ||