Diffstat (limited to 'noncore/net/mail/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/mainwindow.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp index 93d80d9..0a45445 100644 --- a/noncore/net/mail/mainwindow.cpp +++ b/noncore/net/mail/mainwindow.cpp | |||
@@ -36,156 +36,154 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) | |||
36 | 36 | ||
37 | composeMail = new QAction( tr( "Compose new mail" ), ICON_COMPOSEMAIL, | 37 | composeMail = new QAction( tr( "Compose new mail" ), ICON_COMPOSEMAIL, |
38 | 0, 0, this ); | 38 | 0, 0, this ); |
39 | composeMail->addTo( toolBar ); | 39 | composeMail->addTo( toolBar ); |
40 | composeMail->addTo( mailMenu ); | 40 | composeMail->addTo( mailMenu ); |
41 | 41 | ||
42 | sendQueued = new QAction( tr( "Send queued mails" ), ICON_SENDQUEUED, | 42 | sendQueued = new QAction( tr( "Send queued mails" ), ICON_SENDQUEUED, |
43 | 0, 0, this ); | 43 | 0, 0, this ); |
44 | sendQueued->addTo( toolBar ); | 44 | sendQueued->addTo( toolBar ); |
45 | sendQueued->addTo( mailMenu ); | 45 | sendQueued->addTo( mailMenu ); |
46 | 46 | ||
47 | /* | 47 | /* |
48 | syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, | 48 | syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, |
49 | 0, 0, this ); | 49 | 0, 0, this ); |
50 | syncFolders->addTo( toolBar ); | 50 | syncFolders->addTo( toolBar ); |
51 | syncFolders->addTo( mailMenu ); | 51 | syncFolders->addTo( mailMenu ); |
52 | */ | 52 | */ |
53 | 53 | ||
54 | showFolders = new QAction( tr( "Show/Hide folders" ), ICON_SHOWFOLDERS, | 54 | showFolders = new QAction( tr( "Show/Hide folders" ), ICON_SHOWFOLDERS, |
55 | 0, 0, this, 0, true ); | 55 | 0, 0, this, 0, true ); |
56 | showFolders->addTo( toolBar ); | 56 | showFolders->addTo( toolBar ); |
57 | showFolders->addTo( mailMenu ); | 57 | showFolders->addTo( mailMenu ); |
58 | showFolders->setOn( true ); | 58 | showFolders->setOn( true ); |
59 | connect(showFolders, SIGNAL( toggled(bool) ), | 59 | connect(showFolders, SIGNAL( toggled(bool) ), |
60 | SLOT( slotShowFolders(bool) ) ); | 60 | SLOT( slotShowFolders(bool) ) ); |
61 | 61 | ||
62 | /* | 62 | /* |
63 | searchMails = new QAction( tr( "Search mails" ), QIconSet( Resource::loadPixmap("find") ), | 63 | searchMails = new QAction( tr( "Search mails" ), QIconSet( Resource::loadPixmap("find") ), |
64 | 0, 0, this ); | 64 | 0, 0, this ); |
65 | searchMails->addTo( toolBar ); | 65 | searchMails->addTo( toolBar ); |
66 | searchMails->addTo( mailMenu ); | 66 | searchMails->addTo( mailMenu ); |
67 | */ | 67 | */ |
68 | 68 | ||
69 | deleteMails = new QAction(tr("Delete Mail"), QIconSet( Resource::loadPixmap("trash")), 0, 0, this); | 69 | deleteMails = new QAction(tr("Delete Mail"), QIconSet( Resource::loadPixmap("trash")), 0, 0, this); |
70 | deleteMails->addTo( toolBar ); | 70 | deleteMails->addTo( toolBar ); |
71 | deleteMails->addTo( mailMenu ); | 71 | deleteMails->addTo( mailMenu ); |
72 | connect( deleteMails, SIGNAL( activated() ), | 72 | connect( deleteMails, SIGNAL( activated() ), |
73 | SLOT( slotDeleteMail() ) ); | 73 | SLOT( slotDeleteMail() ) ); |
74 | 74 | ||
75 | editSettings = new QAction( tr( "Edit settings" ), QIconSet( Resource::loadPixmap("SettingsIcon") ) , | 75 | editSettings = new QAction( tr( "Edit settings" ), QIconSet( Resource::loadPixmap("SettingsIcon") ) , |
76 | 0, 0, this ); | 76 | 0, 0, this ); |
77 | editSettings->addTo( settingsMenu ); | 77 | editSettings->addTo( settingsMenu ); |
78 | connect( editSettings, SIGNAL( activated() ), | 78 | connect( editSettings, SIGNAL( activated() ), |
79 | SLOT( slotEditSettings() ) ); | 79 | SLOT( slotEditSettings() ) ); |
80 | editAccounts = new QAction( tr( "Configure accounts" ), QIconSet( Resource::loadPixmap("mail/editaccounts") ) , | 80 | editAccounts = new QAction( tr( "Configure accounts" ), QIconSet( Resource::loadPixmap("mail/editaccounts") ) , |
81 | 0, 0, this ); | 81 | 0, 0, this ); |
82 | editAccounts->addTo( settingsMenu ); | 82 | editAccounts->addTo( settingsMenu ); |
83 | 83 | ||
84 | //setCentralWidget( view ); | ||
85 | 84 | ||
86 | QVBox* wrapperBox = new QVBox( this ); | 85 | QWidget *view = new QWidget( this ); |
87 | setCentralWidget( wrapperBox ); | 86 | setCentralWidget( view ); |
88 | |||
89 | QWidget *view = new QWidget( wrapperBox ); | ||
90 | layout = new QBoxLayout ( view, QBoxLayout::LeftToRight ); | 87 | layout = new QBoxLayout ( view, QBoxLayout::LeftToRight ); |
91 | 88 | ||
92 | folderView = new AccountView( view ); | 89 | folderView = new AccountView( view ); |
93 | folderView->header()->hide(); | 90 | folderView->header()->hide(); |
94 | folderView->setRootIsDecorated( true ); | 91 | folderView->setRootIsDecorated( true ); |
95 | folderView->addColumn( tr( "Mailbox" ) ); | 92 | folderView->addColumn( tr( "Mailbox" ) ); |
96 | 93 | ||
97 | layout->addWidget( folderView ); | 94 | layout->addWidget( folderView ); |
98 | 95 | ||
99 | mailView = new QListView( view ); | 96 | mailView = new QListView( view ); |
100 | mailView->addColumn( "" ); | 97 | mailView->addColumn( "" ); |
101 | mailView->addColumn( tr( "Subject" ),QListView::Manual ); | 98 | mailView->addColumn( tr( "Subject" ),QListView::Manual ); |
102 | mailView->addColumn( tr( "Sender" ),QListView::Manual ); | 99 | mailView->addColumn( tr( "Sender" ),QListView::Manual ); |
103 | mailView->addColumn( tr( "Size" ),QListView::Manual); | 100 | mailView->addColumn( tr( "Size" ),QListView::Manual); |
104 | mailView->addColumn( tr( "Date" )); | 101 | mailView->addColumn( tr( "Date" )); |
105 | mailView->setAllColumnsShowFocus(true); | 102 | mailView->setAllColumnsShowFocus(true); |
106 | mailView->setShowSortIndicator(true); | 103 | mailView->setShowSortIndicator(true); |
107 | mailView->setSorting(4,false); | 104 | mailView->setSorting(4,false); |
108 | 105 | ||
109 | statusWidget = new StatusWidget( wrapperBox ); | ||
110 | statusWidget->hide(); | ||
111 | |||
112 | layout->addWidget( mailView ); | 106 | layout->addWidget( mailView ); |
113 | layout->setStretchFactor( folderView, 1 ); | 107 | layout->setStretchFactor( folderView, 1 ); |
114 | layout->setStretchFactor( mailView, 2 ); | 108 | layout->setStretchFactor( mailView, 2 ); |
115 | 109 | ||
116 | m_Rotate = (QApplication::desktop()->width() > QApplication::desktop()->height()?0:90); | 110 | m_Rotate = (QApplication::desktop()->width() > QApplication::desktop()->height()?0:90); |
117 | 111 | ||
118 | slotAdjustLayout(); | 112 | slotAdjustLayout(); |
119 | 113 | ||
120 | QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); | 114 | QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); |
121 | QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); | 115 | QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); |
122 | 116 | ||
123 | connect( mailView, SIGNAL( mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ),this, | 117 | connect( mailView, SIGNAL( mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ),this, |
124 | SLOT( mailLeftClicked(int,QListViewItem*,const QPoint&,int) ) ); | 118 | SLOT( mailLeftClicked(int,QListViewItem*,const QPoint&,int) ) ); |
125 | connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, | 119 | connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, |
126 | SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); | 120 | SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); |
121 | |||
127 | connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), | 122 | connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), |
128 | this,SLOT(refreshMailView(const QValueList<RecMailP>&))); | 123 | this,SLOT(refreshMailView(const QValueList<RecMailP>&))); |
124 | |||
129 | connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); | 125 | connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); |
130 | connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); | 126 | connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); |
127 | |||
131 | // connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); | 128 | // connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); |
132 | connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); | 129 | connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); |
133 | // Added by Stefan Eilers to allow starting by addressbook.. | 130 | // Added by Stefan Eilers to allow starting by addressbook.. |
134 | // copied from old mail2 | 131 | // copied from old mail2 |
132 | |||
135 | #if !defined(QT_NO_COP) | 133 | #if !defined(QT_NO_COP) |
136 | connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ), | 134 | connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ), |
137 | this, SLOT( appMessage(const QCString&,const QByteArray&) ) ); | 135 | this, SLOT( appMessage(const QCString&,const QByteArray&) ) ); |
138 | m_sysChannel = new QCopChannel( "QPE/System", this ); | 136 | m_sysChannel = new QCopChannel( "QPE/System", this ); |
139 | connect( m_sysChannel, SIGNAL( received(const QCString&,const QByteArray&) ), | 137 | connect( m_sysChannel, SIGNAL( received(const QCString&,const QByteArray&) ), |
140 | this, SLOT( systemMessage(const QCString&,const QByteArray&) ) ); | 138 | this, SLOT( systemMessage(const QCString&,const QByteArray&) ) ); |
141 | #endif | 139 | #endif |
142 | 140 | ||
143 | QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); | 141 | QTimer::singleShot( 10, this, SLOT( slotAdjustColumns() ) ); |
144 | } | 142 | } |
145 | 143 | ||
146 | MainWindow::~MainWindow() | 144 | MainWindow::~MainWindow() |
147 | { | 145 | { |
148 | } | 146 | } |
149 | 147 | ||
150 | void MainWindow::systemMessage( const QCString& msg, const QByteArray& data ) | 148 | void MainWindow::systemMessage( const QCString& msg, const QByteArray& data ) |
151 | { | 149 | { |
152 | int _newrotation; | 150 | int _newrotation; |
153 | QDataStream stream( data, IO_ReadOnly ); | 151 | QDataStream stream( data, IO_ReadOnly ); |
154 | if ( msg == "setCurrentRotation(int)" ) | 152 | if ( msg == "setCurrentRotation(int)" ) |
155 | { | 153 | { |
156 | stream >> _newrotation; | 154 | stream >> _newrotation; |
157 | if (m_Rotate != _newrotation) { | 155 | if (m_Rotate != _newrotation) { |
158 | slotAdjustLayout(); | 156 | slotAdjustLayout(); |
159 | m_Rotate = _newrotation; | 157 | m_Rotate = _newrotation; |
160 | } | 158 | } |
161 | } | 159 | } |
162 | } | 160 | } |
163 | 161 | ||
164 | void MainWindow::appMessage(const QCString &, const QByteArray &) | 162 | void MainWindow::appMessage(const QCString &, const QByteArray &) |
165 | { | 163 | { |
166 | odebug << "appMessage not reached" << oendl; | 164 | odebug << "appMessage not reached" << oendl; |
167 | } | 165 | } |
168 | 166 | ||
169 | void MainWindow::slotAdjustLayout() { | 167 | void MainWindow::slotAdjustLayout() { |
170 | 168 | ||
171 | QWidget *d = QApplication::desktop(); | 169 | QWidget *d = QApplication::desktop(); |
172 | if ( d->width() < d->height() ) { | 170 | if ( d->width() < d->height() ) { |
173 | layout->setDirection( QBoxLayout::TopToBottom ); | 171 | layout->setDirection( QBoxLayout::TopToBottom ); |
174 | } else { | 172 | } else { |
175 | layout->setDirection( QBoxLayout::LeftToRight ); | 173 | layout->setDirection( QBoxLayout::LeftToRight ); |
176 | } | 174 | } |
177 | } | 175 | } |
178 | 176 | ||
179 | void MainWindow::slotAdjustColumns() | 177 | void MainWindow::slotAdjustColumns() |
180 | { | 178 | { |
181 | bool hidden = folderView->isHidden(); | 179 | bool hidden = folderView->isHidden(); |
182 | if ( hidden ) folderView->show(); | 180 | if ( hidden ) folderView->show(); |
183 | folderView->setColumnWidth( 0, folderView->visibleWidth() ); | 181 | folderView->setColumnWidth( 0, folderView->visibleWidth() ); |
184 | if ( hidden ) folderView->hide(); | 182 | if ( hidden ) folderView->hide(); |
185 | 183 | ||
186 | mailView->setColumnWidth( 0, 10 ); | 184 | mailView->setColumnWidth( 0, 10 ); |
187 | mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 ); | 185 | mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 ); |
188 | mailView->setColumnWidth( 2, 80 ); | 186 | mailView->setColumnWidth( 2, 80 ); |
189 | mailView->setColumnWidth( 3, 50 ); | 187 | mailView->setColumnWidth( 3, 50 ); |
190 | mailView->setColumnWidth( 4, 50 ); | 188 | mailView->setColumnWidth( 4, 50 ); |
191 | } | 189 | } |