summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-12-13 12:35:00 (UTC)
committer zautrix <zautrix>2004-12-13 12:35:00 (UTC)
commit7ac6c21e832b7d16bd0888d0b66252b6e152005a (patch) (side-by-side diff)
treec7610e0e25020f19af82ac6257c2debab2638316
parent17b25691f0332e648dd1d800e89ccf4e1da8955d (diff)
downloadkdepimpi-7ac6c21e832b7d16bd0888d0b66252b6e152005a.zip
kdepimpi-7ac6c21e832b7d16bd0888d0b66252b6e152005a.tar.gz
kdepimpi-7ac6c21e832b7d16bd0888d0b66252b6e152005a.tar.bz2
many bugfixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt10
-rw-r--r--kaddressbook/kabcore.cpp11
-rw-r--r--kaddressbook/viewmanager.cpp11
-rw-r--r--kmicromail/libmailwrapper/settings.cpp2
-rw-r--r--kmicromail/opiemail.cpp27
-rw-r--r--kmicromail/opiemail.h2
-rw-r--r--kmicromail/viewmail.cpp5
-rw-r--r--kmicromail/viewmail.h1
-rw-r--r--korganizer/calendarview.cpp24
-rw-r--r--qtcompat/qinputdialog.cpp7
10 files changed, 80 insertions, 20 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index 46d59a3..ec75fad 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,61 +1,71 @@
Info about the changes in new versions of KDE-Pim/Pi
********** VERSION 1.9.15 ************
Usebilty enhancements in KO/Pi:
When clicking on the date in a month view cell, the day view is shown.
Old behaviour was, that the "new event" dialog popped up.
Added a one step "undo delete" in KO/Pi (Accessable in the "Action" menu).
That means, you can restore the latest
event/todo/journal you have deleted.
A journal is deleted, if you clear all the text of the journal.
+Fixed the bug of the editor dialogs in KO/Pi of version 1.9.14.
+
+KA/Pi starting in 480x640 resolution:
+Hide the filter action in toolbar
+and added icons for undo/delete/redo in toolbar.
+
+Change in OM/Pi ViewMail dialog:
+When clicking on the "delete" icon the mail is deleted after confirmation as usual. But the edit dialog is not closed as before, now the next mail in the folder is shown automatically (if there is any).
+
+Fixed a crash when deleting mail-accounts in OM/Pi.
********** VERSION 1.9.14 ************
Fixed some problems with the dialog sizes when switching
portrait/landscape mode on 640x480 PDA display.
Fixed some other small bugs in KA/Pi KO/Pi and OM/Pi and PwM/Pi.
Fixed an ugly bug in KOpieMail:
KOpieMail was not able to write files (mails) to MSDOS file system,
like on an usual preformatted SD card. That should work now.
To save your mail data on the Sd card do the following:
Create a dir on the SD card:
mkdir /mnt/card/localmail
Go to your home dir:
cd
Go to kopiemail data storage dir:
cd kdepim/apps/kopiemail
Create a symlink to the SD card:
ls -s /mnt/card/localmail
Now KOpieMail will store all mails on the SD card.
KO/Pi Monthview:
Now "Go to Today" selects the current month from day 1-end,
not the current date + some days.
I.e. "Go to Today" shows now always
the current month with first day of month in the first row.
Added missing German translation.
Fixed icons of executeable on Wintendo.
Added a "Show next Mail" button to the OM/Pi
mail viewer such that the mail below the current mail
in the mail list view of the current folder
can be read with a single click.
********** VERSION 1.9.13 ************
Fixed nasty PwM/Pi file reading bug, when
the used hash algo of file is different then the global
hash algo.
Added KA/Pi support for opie mailit mailapplication.
Fixed some bugs in OM/Pi.
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index b7edccd..f6bdda4 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -742,96 +742,97 @@ void KABCore::mailVCard( const QStringList& uids )
outFile.close();
urls.append( fileName );
}
}
bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") );
/*US
kapp->invokeMailer( QString::null, QString::null, QString::null,
QString::null, // subject
QString::null, // body
QString::null,
urls ); // attachments
*/
}
/**
Beams the "WhoAmI contact.
*/
void KABCore::beamMySelf()
{
KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI();
if (!a.isEmpty())
{
QStringList uids;
uids << a.uid();
beamVCard(uids);
} else {
KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) );
}
}
void KABCore::updateMainWindow()
{
mMainWindow->showMaximized();
mMainWindow->update();
}
void KABCore::resizeEvent(QResizeEvent* e )
{
if ( !mMiniSplitter )
return;
+ //qDebug("KABCore::resizeEvent(QResizeEvent* e ) ");
if ( QApplication::desktop()->width() >= 480 ) {
if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480
if ( mMiniSplitter->orientation() == Qt::Vertical ) {
mMiniSplitter->setOrientation( Qt::Horizontal);
mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
if ( QApplication::desktop()->width() <= 640 ) {
//mMainWindow->setMaximumSize( QApplication::desktop()->size() );
mViewManager->getFilterAction()->setComboWidth( 150 );
QTimer::singleShot( 1, this , SLOT ( updateMainWindow()));
}
}
} else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640
if ( mMiniSplitter->orientation() == Qt::Horizontal ) {
mMiniSplitter->setOrientation( Qt::Vertical );
mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
if ( QApplication::desktop()->width() <= 640 ) {
//mMainWindow->setMaximumSize( QApplication::desktop()->size() );
mMainWindow->showMinimized();
mViewManager->getFilterAction()->setComboWidth( 0 );
QTimer::singleShot( 1, this , SLOT ( updateMainWindow()));
}
}
}
}
}
void KABCore::export2phone()
{
QStringList uids;
XXPortSelectDialog dlg( this, false, this );
if ( dlg.exec() )
uids = dlg.uids();
else
return;
if ( uids.isEmpty() )
return;
// qDebug("count %d ", uids.count());
KAex2phonePrefs ex2phone;
ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
if ( !ex2phone.exec() ) {
return;
}
KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
@@ -2147,101 +2148,103 @@ void KABCore::addActionsManually()
settingsMenu->insertSeparator();
mActionConfigKAddressbook->plug( settingsMenu );
if ( mIsPart ) {
//US not implemented yet
//mActionConfigShortcuts->plug( settingsMenu );
//mActionConfigureToolbars->plug( settingsMenu );
} else {
//US not implemented yet
//mActionKeyBindings->plug( settingsMenu );
}
settingsMenu->insertSeparator();
mActionJumpBar->plug( settingsMenu );
mActionDetails->plug( settingsMenu );
//if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop )
mActionDetails->plug( tb );
settingsMenu->insertSeparator();
#ifndef DESKTOP_VERSION
if ( Ir::supported() ) mActionBR->plug(settingsMenu );
#endif
settingsMenu->insertSeparator();
mActionWhoAmI->plug( settingsMenu );
mActionEditCategories->plug( settingsMenu );
mActionEditCategories->plug( changeMenu );
mActionCategories->plug( changeMenu );
mActionManageCategories->plug( changeMenu );
mActionCategories->plug( settingsMenu );
mActionManageCategories->plug( settingsMenu );
mActionWN->plug( helpMenu );
mActionSyncHowto->plug( helpMenu );
mActionKdeSyncHowto->plug( helpMenu );
mActionMultiSyncHowto->plug( helpMenu );
mActionFaq->plug( helpMenu );
mActionLicence->plug( helpMenu );
mActionAboutKAddressbook->plug( helpMenu );
if (KGlobal::getDesktopSize() > KGlobal::Small ) {
mActionSave->plug( tb );
mViewManager->getFilterAction()->plug ( tb);
- if (KGlobal::getDesktopSize() == KGlobal::Desktop ) {
- mActionUndo->plug( tb );
- mActionDelete->plug( tb );
- mActionRedo->plug( tb );
+ //LR hide filteraction on started in 480x640
+ if (QApplication::desktop()->width() == 480 ) {
+ mViewManager->getFilterAction()->setComboWidth( 0 );
}
+ mActionUndo->plug( tb );
+ mActionDelete->plug( tb );
+ mActionRedo->plug( tb );
} else {
mActionSave->plug( tb );
tb->enableMoving(false);
}
//mActionQuit->plug ( tb );
// tb->insertWidget(-1, 0, mIncSearchWidget, 6);
//US link the searchwidget first to this.
// The real linkage to the toolbar happens later.
//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
//US tb->insertItem( mIncSearchWidget );
/*US
mIncSearchWidget = new IncSearchWidget( tb );
connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
SLOT( incrementalSearch( const QString& ) ) );
mJumpButtonBar = new JumpButtonBar( this, this );
//US topLayout->addWidget( mJumpButtonBar );
this->layout()->add( mJumpButtonBar );
*/
#endif //KAB_EMBEDDED
mActionExport2phone->plug( ExportMenu );
connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) );
syncManager->fillSyncMenu();
}
void KABCore::showLicence()
{
KApplication::showLicence();
}
void KABCore::manageCategories( )
{
KABCatPrefs* cp = new KABCatPrefs();
cp->show();
int w =cp->sizeHint().width() ;
int h = cp->sizeHint().height() ;
int dw = QApplication::desktop()->width();
int dh = QApplication::desktop()->height();
cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
if ( !cp->exec() ) {
delete cp;
return;
}
int count = 0;
diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp
index 0d91c12..33bef5a 100644
--- a/kaddressbook/viewmanager.cpp
+++ b/kaddressbook/viewmanager.cpp
@@ -15,143 +15,147 @@
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#ifndef KAB_EMBEDDED
#include <libkdepim/kvcarddrag.h>
#include <kabc/vcardconverter.h>
#include <kconfig.h>
#include <kdeversion.h>
#include <kiconloader.h>
#include <klocale.h>
#include <kmessagebox.h>
#include <kmultipledrag.h>
#include <ktrader.h>
#include <kurldrag.h>
#include "addresseeutil.h"
#else //KAB_EMBEDDED
#include "views/kaddressbookiconview.h"
#include "views/kaddressbooktableview.h"
#include "views/kaddressbookcardview.h"
#include "kaddressbookview.h"
#include <qaction.h>
#include <qmessagebox.h>
#include <qpopupmenu.h>
#include <kconfigbase.h>
#endif //KAB_EMBEDDED
#include <kdebug.h>
#include <kactionclasses.h>
#include <qlayout.h>
+#include <qapplication.h>
#include <qwidgetstack.h>
#include <kabc/addressbook.h>
#include "filtereditdialog.h"
#include "addviewdialog.h"
#include "kabcore.h"
#include "kabprefs.h"
#include "viewmanager.h"
ViewManager::ViewManager( KABCore *core, QWidget *parent, const char *name )
: QWidget( parent, name ), mCore( core ), mActiveView( 0 )
{
initGUI();
initActions();
mViewDict.setAutoDelete( true );
createViewFactories();
}
ViewManager::~ViewManager()
{
unloadViews();
mViewFactoryDict.clear();
}
void ViewManager::scrollUP()
{
if ( mActiveView )
mActiveView->scrollUP();
}
void ViewManager::scrollDOWN()
{
if ( mActiveView )
mActiveView->scrollDOWN();
}
void ViewManager::restoreSettings()
{
mViewNameList = KABPrefs::instance()->mViewNames;
QString activeViewName = KABPrefs::instance()->mCurrentView;
mActionSelectView->setItems( mViewNameList );
// Filter
mFilterList = Filter::restore( mCore->config(), "Filter" );
mActionSelectFilter->setItems( filterNames() );
mActionSelectFilter->setCurrentItem( KABPrefs::instance()->mCurrentFilter );
- mActionSelectFilter->setComboWidth( 150 );
+ int cw = 150;
+ if (QApplication::desktop()->width() == 480 )
+ cw = 0;
+ mActionSelectFilter->setComboWidth( cw );
// Tell the views to reread their config, since they may have
// been modified by global settings
QString _oldgroup = mCore->config()->group();
QDictIterator<KAddressBookView> it( mViewDict );
for ( it.toFirst(); it.current(); ++it ) {
KConfigGroupSaver saver( mCore->config(), it.currentKey() );
it.current()->readConfig( mCore->config() );
}
setActiveView( activeViewName );
mActionDeleteView->setEnabled( mViewNameList.count() > 1 );
}
void ViewManager::saveSettings()
{
QString _oldgroup = mCore->config()->group();
QDictIterator<KAddressBookView> it( mViewDict );
for ( it.toFirst(); it.current(); ++it ) {
KConfigGroupSaver saver( mCore->config(), it.currentKey() );
#ifdef DESKTOP_VERSION
(*it)->writeConfig( mCore->config() );
#else
(*it).writeConfig( mCore->config() );
#endif
}
Filter::save( mCore->config(), "Filter", mFilterList );
KABPrefs::instance()->mCurrentFilter = mActionSelectFilter->currentItem();
// write the view name list
KABPrefs::instance()->mViewNames = mViewNameList;
KABPrefs::instance()->mCurrentView = mActiveView->caption();
}
QStringList ViewManager::selectedUids() const
{
if ( mActiveView )
return mActiveView->selectedUids();
else
return QStringList();
}
QStringList ViewManager::selectedEmails() const
{
if ( mActiveView )
@@ -552,97 +556,100 @@ void ViewManager::startDrag()
}
drag->addDragObject( new KVCardDrag( vcards.join( "\r\n" ), this ) );
drag->setPixmap( KGlobal::iconLoader()->loadIcon( "vcard", KIcon::Desktop ) );
drag->dragCopy();
#else //KAB_EMBEDDED
qDebug("ViewManager::startDrag() has to be changed!!" );
#endif //KAB_EMBEDDED
}
void ViewManager::doSearch( const QString& s,KABC::Field *field )
{
if ( mActiveView )
mActiveView->doSearch( s, field );
}
void ViewManager::setActiveFilter( int index )
{
Filter currentFilter;
if ( ( index - 1 ) < 0 )
currentFilter = Filter();
else
currentFilter = mFilterList[ index - 1 ];
// Check if we have a view. Since the filter combo is created before
// the view, this slot could be called before there is a valid view.
if ( mActiveView ) {
mActiveView->setFilter( currentFilter );
mActiveView->refresh();
emit selected( QString::null );
}
}
void ViewManager::configureFilters()
{
FilterDialog dlg( this );
dlg.setFilters( mFilterList );
if ( dlg.exec() )
mFilterList = dlg.filters();
uint pos = mActionSelectFilter->currentItem();
mActionSelectFilter->setItems( filterNames() );
mActionSelectFilter->setCurrentItem( pos );
setActiveFilter( pos );
- mActionSelectFilter->setComboWidth( 150 );
+ int cw = 150;
+ if (QApplication::desktop()->width() == 480 )
+ cw = 0;
+ mActionSelectFilter->setComboWidth( cw );
}
QStringList ViewManager::filterNames() const
{
QStringList names( i18n( "No Filter" ) );
Filter::List::ConstIterator it;
for ( it = mFilterList.begin(); it != mFilterList.end(); ++it )
names.append( (*it).name() );
return names;
}
int ViewManager::filterPosition( const QString &name ) const
{
int pos = 0;
Filter::List::ConstIterator it;
for ( it = mFilterList.begin(); it != mFilterList.end(); ++it, ++pos )
if ( name == (*it).name() )
return pos + 1;
return 0;
}
void ViewManager::initActions()
{
//US <ActionList name="view_loadedviews"/>
//US <Separator/>
#ifdef KAB_EMBEDDED
QPopupMenu *viewmenu = (QPopupMenu*)mCore->getViewMenu();
QPopupMenu *settingsmenu = (QPopupMenu*)mCore->getSettingsMenu();
QPopupMenu *filtermenu = (QPopupMenu*)mCore->getFilterMenu();
#endif //KAB_EMBEDDED
mActionSelectView = new KSelectAction( i18n( "Select View" ), 0, mCore->actionCollection(), "select_view" );
#if KDE_VERSION >= 309
mActionSelectView->setMenuAccelsEnabled( false );
#endif
connect( mActionSelectView, SIGNAL( activated( const QString& ) ),
SLOT( setActiveView( const QString& ) ) );
#ifdef KAB_EMBEDDED
mActionSelectView->plug(viewmenu);
viewmenu->insertSeparator();
#endif //KAB_EMBEDDED
diff --git a/kmicromail/libmailwrapper/settings.cpp b/kmicromail/libmailwrapper/settings.cpp
index 04afe7c..19093b1 100644
--- a/kmicromail/libmailwrapper/settings.cpp
+++ b/kmicromail/libmailwrapper/settings.cpp
@@ -5,98 +5,98 @@
#include <kconfig.h>
#include <kstandarddirs.h>
#include "settings.h"
//#include "defines.h"
#define IMAP_PORT "143"
#define IMAP_SSL_PORT "993"
#define SMTP_PORT "25"
#define SMTP_SSL_PORT "465"
#define POP3_PORT "110"
#define POP3_SSL_PORT "995"
#define NNTP_PORT "119"
#define NNTP_SSL_PORT "563"
Settings::Settings()
: QObject()
{
accounts.setAutoDelete( true ); ;
updateAccounts();
//qDebug("++++++++++++++++++new settings ");
}
void Settings::checkDirectory()
{
return;
locateLocal("data", "kopiemail" );
/*
if ( !QDir( (QString) getenv( "HOME" ) + "/Applications/opiemail/" ).exists() ) {
system( "mkdir -p $HOME/Applications/opiemail" );
qDebug("$HOME/Applications/opiemail created ");
}
*/
}
QList<Account> Settings::getAccounts()
{
return accounts;
}
void Settings::addAccount( Account *account )
{
accounts.append( account );
}
void Settings::delAccount( Account *account )
{
- accounts.remove( account );
account->remove();
+ accounts.remove( account );
}
void Settings::updateAccounts()
{
accounts.clear();
QDir dir( locateLocal("data", "kopiemail" ) );
QStringList::Iterator it;
QStringList imap = dir.entryList( "imap-*" );
for ( it = imap.begin(); it != imap.end(); it++ ) {
IMAPaccount *account = new IMAPaccount( (*it).replace(0, 5, "") );
accounts.append( account );
}
QStringList pop3 = dir.entryList( "pop3-*" );
for ( it = pop3.begin(); it != pop3.end(); it++ ) {
POP3account *account = new POP3account( (*it).replace(0, 5, "") );
accounts.append( account );
}
QStringList smtp = dir.entryList( "smtp-*" );
for ( it = smtp.begin(); it != smtp.end(); it++ ) {
SMTPaccount *account = new SMTPaccount( (*it).replace(0, 5, "") );
accounts.append( account );
}
QStringList nntp = dir.entryList( "nntp-*" );
for ( it = nntp.begin(); it != nntp.end(); it++ ) {
NNTPaccount *account = new NNTPaccount( (*it).replace(0, 5, "") );
accounts.append( account );
}
readAccounts();
}
void Settings::saveAccounts()
{
checkDirectory();
Account *it;
for ( it = accounts.first(); it; it = accounts.next() ) {
it->save();
}
}
void Settings::readAccounts()
{
checkDirectory();
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index ec192ea..915b3e8 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -254,126 +254,153 @@ void OpieMail::slotEditAccounts()
settings = new Settings();
folderView->populate( settings->getAccounts() );
}
void OpieMail::replyMail()
{
QListViewItem*item = mailView->currentItem();
if (!item) return;
RecMailP mail = ((MailListViewItem*)item)->data();
RecBodyP body = folderView->fetchBody(mail);
QString rtext;
rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose
.arg( mail->getFrom())
.arg( mail->getDate());
QString text = body->Bodytext();
QStringList lines = QStringList::split(QRegExp("\\n"), text);
QStringList::Iterator it;
for (it = lines.begin(); it != lines.end(); it++)
{
rtext += "> " + *it + "\n";
}
rtext += "\n";
QString prefix;
if ( mail->getSubject().find(QRegExp("^Re: .*$")) != -1) prefix = "";
else prefix = "Re: "; // no i18n on purpose
Settings *settings = new Settings();
ComposeMail composer( settings ,this, 0, true);
if (mail->Replyto().isEmpty()) {
composer.setTo( mail->getFrom());
} else {
composer.setTo( mail->Replyto());
}
composer.setSubject( prefix + mail->getSubject());
composer.setMessage( rtext );
composer.setInReplyTo( mail->Msgid());
composer.setCharset( body->getCharset() );
if ( QDialog::Accepted == KApplication::execDialog( &composer ) )
{
mail->Wrapper()->answeredMail(mail);
}
delete settings;
}
+void OpieMail::closeViewMail(ViewMail * vm)
+{
+ vm->hide();
+}
+void OpieMail::deleteAndDisplayNextMail(ViewMail * vm)
+{
+ QListViewItem*item = mailView->currentItem();
+ if (!item ) {
+ closeViewMail(vm);
+ return;
+ }
+ RecMailP mail = ((MailListViewItem*)item)->data();
+ mail->Wrapper()->deleteMail( mail );
+ item = item->itemBelow();
+ if (!item ) {
+ closeViewMail(vm);
+ return;
+ }
+ mailView->setCurrentItem(item);
+ mail = ((MailListViewItem*)item)->data();
+ RecBodyP body = folderView->fetchBody(mail);
+ vm->setBody( body );
+ vm->setMail( mail );
+}
void OpieMail::displayNextMail(ViewMail * vm)
{
QListViewItem*item = mailView->currentItem();
if (!item) return;
+ ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() );
item = item->itemBelow();
if (!item) {
vm->setCaption(i18n("End of List" ));
return;
}
mailView->setCurrentItem(item);
RecMailP mail = ((MailListViewItem*)item)->data();
RecBodyP body = folderView->fetchBody(mail);
vm->setBody( body );
vm->setMail( mail );
}
void OpieMail::displayMail()
{
QListViewItem*item = mailView->currentItem();
if (!item) return;
RecMailP mail = ((MailListViewItem*)item)->data();
RecBodyP body = folderView->fetchBody(mail);
ViewMail readMail( this,"", Qt::WType_Modal );
readMail.setBody( body );
readMail.setMail( mail );
#ifndef DESKTOP_VERSION
readMail.showMaximized();
#else
readMail.resize( 640, 480);
#endif
connect( &readMail,SIGNAL( showNextMail(ViewMail *) ), this, SLOT( displayNextMail(ViewMail *) ) );
+ connect( &readMail,SIGNAL( deleteAndDisplayNextMail(ViewMail *) ), this, SLOT(deleteAndDisplayNextMail(ViewMail *) ) );
+
readMail.exec();
if ( readMail.deleted )
{
folderView->refreshCurrent();
}
else
{
( (MailListViewItem*)item )->setPixmap( 0, QPixmap() );
}
}
void OpieMail::slotGetAllMail()
{
QListViewItem * item = folderView->firstChild();
while ( item ){
((AccountViewItem *)item)->contextMenuSelected( 101 );
item = item->nextSibling ();
}
}
void OpieMail::slotGetMail()
{
QListViewItem * item = folderView->currentItem();
if ( ! item ) return;
((AccountViewItem *)item)->contextMenuSelected( 101 );
}
void OpieMail::slotDeleteMail()
{
if (!mailView->currentItem()) return;
RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
{
mail->Wrapper()->deleteMail( mail );
folderView->refreshCurrent();
}
}
void OpieMail::slotDeleteAllMail()
{
QValueList<RecMailP> t;
if ( QMessageBox::warning(this, i18n("Delete All Mails"), i18n("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
{
MailListViewItem* item = (MailListViewItem*)mailView->firstChild ();
while ( item ) {
if ( item->isSelected() ) {
t.append( item->data() );
}
item = (MailListViewItem*)item->nextSibling();
}
diff --git a/kmicromail/opiemail.h b/kmicromail/opiemail.h
index 30968a7..a81a34c 100644
--- a/kmicromail/opiemail.h
+++ b/kmicromail/opiemail.h
@@ -1,58 +1,60 @@
// CHANGED 2004-09-31 Lutz Rogowski
#ifndef OPIEMAIL_H
#define OPIEMAIL_H
#include "mainwindow.h"
#include <libmailwrapper/settings.h>
#include <opie2/osmartpointer.h>
#include <libmailwrapper/mailtypes.h>
#include <viewmail.h>
class OpieMail : public MainWindow
{
Q_OBJECT
public:
OpieMail( QWidget *parent = 0, const char *name = 0 );
virtual ~OpieMail();
static QString appName() { return QString::fromLatin1("kopiemail"); }
public slots:
virtual void slotwriteMail(const QString&name,const QString&email);
virtual void slotwriteMail2(const QString&nameemail);
virtual void slotComposeMail();
virtual void slotExtAppHandler();
virtual void appMessage(const QCString &msg, const QByteArray &data);
virtual void message(const QCString &msg, const QByteArray &data);
protected slots:
+ virtual void deleteAndDisplayNextMail(ViewMail * vm);
virtual void displayNextMail(ViewMail * vm);
virtual void slotSendQueued();
virtual void slotSearchMails();
virtual void slotEditSettings();
virtual void slotEditAccounts();
virtual void displayMail();
virtual void replyMail();
virtual void slotDeleteMail();
virtual void slotGetMail();
virtual void slotGetAllMail();
virtual void slotDeleteAllMail();
virtual void mailHold(int, QListViewItem *,const QPoint&,int);
virtual void slotShowFolders( bool show );
virtual void refreshMailView(const QValueList<RecMailP>&);
virtual void mailLeftClicked( QListViewItem * );
virtual void slotMoveCopyMail();
virtual void slotMoveCopyAllMail();
virtual void reEditMail();
void clearSelection();
private:
+ void closeViewMail(ViewMail * vm);
QString mPendingEmail;
QString mPendingName;
QByteArray mPendingData;
QCString mPendingMessage;
Settings *settings;
};
#endif
diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp
index 60c764c..6d88cad 100644
--- a/kmicromail/viewmail.cpp
+++ b/kmicromail/viewmail.cpp
@@ -461,73 +461,74 @@ void ViewMail::slotReply()
composer.setCharset( m_body->getCharset() );
if ( QDialog::Accepted == KApplication::execDialog( &composer ) )
{
m_recMail->Wrapper()->answeredMail(m_recMail);
}
delete settings;
}
void ViewMail::slotForward()
{
if (!m_gotBody)
{
QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot forward yet."), i18n("Ok"));
return;
}
QString ftext;
ftext += QString("\n----- Forwarded message from %1 -----\n\n")
.arg( m_mail[0] );
if (!m_mail[3].isNull())
ftext += QString("Date: %1\n")
.arg( m_mail[3] );
if (!m_mail[0].isNull())
ftext += QString("From: %1\n")
.arg( m_mail[0] );
if (!m_mail[1].isNull())
ftext += QString("Subject: %1\n")
.arg( m_mail[1] );
ftext += QString("\n%1\n")
.arg( m_mail[2]);
ftext += QString("----- End forwarded message -----\n");
Settings *settings = new Settings();
ComposeMail composer( settings ,this, 0, true);
composer.setSubject( "Fwd: " + m_mail[1] );
composer.setMessage( ftext );
if ( QDialog::Accepted == KApplication::execDialog( &composer ))
{
}
}
void ViewMail::slotDeleteMail( )
{
if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + m_mail[0] + " - " + m_mail[1] ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
{
- m_recMail->Wrapper()->deleteMail( m_recMail );
- hide();
+ emit deleteAndDisplayNextMail( this);
+ //m_recMail->Wrapper()->deleteMail( m_recMail );
+ //hide();
deleted = true;
}
}
MailImageDlg::MailImageDlg(const QString&fname,QWidget *parent, const char *name, bool modal, WFlags f)
: QDialog(parent,name,modal)
{
QVBoxLayout*dlglayout = new QVBoxLayout(this);
dlglayout->setSpacing(2);
dlglayout->setMargin(1);
//m_imageview = new Opie::MM::OImageScrollView(this);
//dlglayout->addWidget(m_imageview);
}
MailImageDlg::~MailImageDlg()
{
}
void MailImageDlg::setName(const QString&fname)
{
qDebug("viewmail.cpp: MailImageDlg::setName Pending");
// m_imageview->setImage(fname);
}
diff --git a/kmicromail/viewmail.h b/kmicromail/viewmail.h
index c2c2ce3..d85b8b2 100644
--- a/kmicromail/viewmail.h
+++ b/kmicromail/viewmail.h
@@ -1,88 +1,89 @@
#ifndef VIEWMAIL_H
#define VIEWMAIL_H
#include "viewmailbase.h"
#include <libmailwrapper/mailtypes.h>
#include <qdialog.h>
#include <qlistview.h>
#include <qmap.h>
#include <qstringlist.h>
#include <qvaluelist.h>
//namespace Opie { namespace MM { class OImageScrollView; } }
class AttachItem : public QListViewItem
{
public:
AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file,
const QString&fsize,int num,const QValueList<int>&path);
AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file,
const QString&fsize,int num,const QValueList<int>&path);
int Partnumber() { return _partNum; }
bool isParentof(const QValueList<int>&path);
private:
int _partNum;
/* needed for a better display of attachments */
QValueList<int> _path;
};
class ViewMail : public ViewMailBase
{
Q_OBJECT
public:
ViewMail( QWidget *parent = 0, const char *name = 0, WFlags fl = 0);
~ViewMail();
void hide();
void exec();
void setMail(const RecMailP&mail );
void setBody(const RecBodyP&body);
bool deleted;
signals:
void showNextMail(ViewMail*);
+ void deleteAndDisplayNextMail(ViewMail *);
protected:
QString deHtml(const QString &string);
AttachItem* searchParent(const QValueList<int>&path);
AttachItem* lastChild(AttachItem*parent);
protected slots:
void slotNextMail() { emit showNextMail(this); };
void slotReply();
void slotForward();
void setText();
void slotItemClicked( QListViewItem * item , const QPoint & point, int c );
void slotDeleteMail( );
void slotShowHtml( bool );
private:
void readConfig();
bool _inLoop;
QString m_mailHtml;
bool m_gotBody;
RecBodyP m_body;
RecMailP m_recMail;
bool m_showHtml;
// 0 from 1 subject 2 bodytext 3 date
QMap <int,QString> m_mail;
// 0 to 1 cc 2 bcc
QMap <int,QStringList> m_mail2;
};
class MailImageDlg:public QDialog
{
Q_OBJECT
public:
MailImageDlg(const QString&,QWidget *parent = 0, const char *name = 0, bool modal = true, WFlags f = 0);
~MailImageDlg();
void setName(const QString&);
protected:
//Opie::MM::OImageScrollView*m_imageview;
};
#endif
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 15c5dd9..a46cd87 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -2428,330 +2428,332 @@ void CalendarView::moveIncidence(Incidence * inc )
if ( mDateFrame->isVisible() )
mDateFrame->hide();
else {
int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ;
int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ;
int dw = QApplication::desktop()->width();
int dh = QApplication::desktop()->height();
mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
mDateFrame->show();
}
mDatePickerMode = 2;
mMoveIncidence = inc ;
QDate da;
if ( mMoveIncidence->type() == "Todo" ) {
Todo * to = (Todo *) mMoveIncidence;
if ( to->hasDueDate() )
da = to->dtDue().date();
else
da = QDate::currentDate();
} else {
da = mMoveIncidence->dtStart().date();
}
//PENDING set date for recurring incidence to date of recurrence
//mMoveIncidenceOldDate;
mDatePicker->setDate( da );
}
void CalendarView::showDatePicker( )
{
//qDebug("CalendarView::showDatePicker( ) ");
if ( mDateFrame->isVisible() )
mDateFrame->hide();
else {
int w =mDatePicker->sizeHint().width() ;
int h = mDatePicker->sizeHint().height() ;
int dw = QApplication::desktop()->width();
int dh = QApplication::desktop()->height();
mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
mDateFrame->show();
}
mDatePickerMode = 1;
mDatePicker->setDate( mNavigator->selectedDates().first() );
}
void CalendarView::showEventEditor()
{
#ifdef DESKTOP_VERSION
mEventEditor->show();
#else
- if ( mEventEditor->width() != QApplication::desktop()->width() ) {
- qDebug("CalendarView: recreate mEventEditor ");
+ if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) {
+ topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") );
+ qDebug("CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() );
delete mEventEditor;
mEventEditor = mDialogManager->getEventEditor();
}
mEventEditor->showMaximized();
#endif
}
void CalendarView::showTodoEditor()
{
#ifdef DESKTOP_VERSION
mTodoEditor->show();
#else
- if ( mTodoEditor->width() != QApplication::desktop()->width() ) {
- qDebug("CalendarView: recreate mTodoEditor ");
+ if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) {
+ topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") );
+ qDebug("CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() );
delete mTodoEditor;
mTodoEditor = mDialogManager->getTodoEditor();
}
mTodoEditor->showMaximized();
#endif
}
void CalendarView::cloneIncidence()
{
Incidence *incidence = currentSelection();
if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
if ( incidence ) {
cloneIncidence(incidence);
}
}
void CalendarView::moveIncidence()
{
Incidence *incidence = currentSelection();
if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
if ( incidence ) {
moveIncidence(incidence);
}
}
void CalendarView::beamIncidence()
{
Incidence *incidence = currentSelection();
if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
if ( incidence ) {
beamIncidence(incidence);
}
}
void CalendarView::toggleCancelIncidence()
{
Incidence *incidence = currentSelection();
if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
if ( incidence ) {
cancelIncidence(incidence);
}
}
void CalendarView::cancelIncidence(Incidence * inc )
{
inc->setCancelled( ! inc->cancelled() );
changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED );
updateView();
}
void CalendarView::cloneIncidence(Incidence * orgInc )
{
Incidence * newInc = orgInc->clone();
newInc->recreate();
if ( newInc->type() == "Todo" ) {
Todo* t = (Todo*) newInc;
- mTodoEditor->editTodo( t );
showTodoEditor();
+ mTodoEditor->editTodo( t );
if ( mTodoEditor->exec() ) {
mCalendar->addTodo( t );
updateView();
} else {
delete t;
}
}
else {
Event* e = (Event*) newInc;
- mEventEditor->editEvent( e );
showEventEditor();
+ mEventEditor->editEvent( e );
if ( mEventEditor->exec() ) {
mCalendar->addEvent( e );
updateView();
} else {
delete e;
}
}
}
void CalendarView::newEvent()
{
// TODO: Replace this code by a common eventDurationHint of KOBaseView.
KOAgendaView *aView = mViewManager->agendaView();
if (aView) {
if (aView->selectionStart().isValid()) {
if (aView->selectedIsAllDay()) {
newEvent(aView->selectionStart(),aView->selectionEnd(),true);
} else {
newEvent(aView->selectionStart(),aView->selectionEnd());
}
return;
}
}
QDate date = mNavigator->selectedDates().first();
QDateTime current = QDateTime::currentDateTime();
if ( date <= current.date() ) {
int hour = current.time().hour() +1;
newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ),
QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) );
} else
newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ),
QDateTime( date, QTime( KOPrefs::instance()->mStartTime +
KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) );
}
void CalendarView::newEvent(QDateTime fh)
{
newEvent(fh,
QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration)));
}
void CalendarView::newEvent(QDate dt)
{
newEvent(QDateTime(dt, QTime(0,0,0)),
QDateTime(dt, QTime(0,0,0)), true);
}
void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay)
{
+ showEventEditor();
mEventEditor->newEvent(fromHint,toHint,allDay);
if ( mFilterView->filtersEnabled() ) {
CalFilter *filter = mFilterView->selectedFilter();
if (filter && filter->showCategories()) {
mEventEditor->setCategories(filter->categoryList().join(",") );
}
if ( filter )
mEventEditor->setSecrecy( filter->getSecrecy() );
}
- showEventEditor();
}
void CalendarView::todoAdded(Todo * t)
{
changeTodoDisplay ( t ,KOGlobals::EVENTADDED);
updateTodoViews();
}
void CalendarView::todoChanged(Todo * t)
{
emit todoModified( t, 4 );
// updateTodoViews();
}
void CalendarView::todoToBeDeleted(Todo *)
{
//qDebug("todoToBeDeleted(Todo *) ");
updateTodoViews();
}
void CalendarView::todoDeleted()
{
//qDebug(" todoDeleted()");
updateTodoViews();
}
void CalendarView::newTodo()
{
+ showTodoEditor();
mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),0,true);
if ( mFilterView->filtersEnabled() ) {
CalFilter *filter = mFilterView->selectedFilter();
if (filter && filter->showCategories()) {
mTodoEditor->setCategories(filter->categoryList().join(",") );
}
if ( filter )
mTodoEditor->setSecrecy( filter->getSecrecy() );
}
- showTodoEditor();
}
void CalendarView::newSubTodo()
{
Todo *todo = selectedTodo();
if ( todo ) newSubTodo( todo );
}
void CalendarView::newSubTodo(Todo *parentEvent)
{
- mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),parentEvent,true);
showTodoEditor();
+ mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),parentEvent,true);
}
void CalendarView::newFloatingEvent()
{
DateList tmpList = mNavigator->selectedDates();
QDate date = tmpList.first();
newEvent( QDateTime( date, QTime( 12, 0, 0 ) ),
QDateTime( date, QTime( 12, 0, 0 ) ), true );
}
void CalendarView::editEvent( Event *event )
{
if ( !event ) return;
if ( event->isReadOnly() ) {
showEvent( event );
return;
}
- mEventEditor->editEvent( event , mFlagEditDescription);
showEventEditor();
+ mEventEditor->editEvent( event , mFlagEditDescription);
}
void CalendarView::editJournal( Journal *jour )
{
if ( !jour ) return;
mDialogManager->hideSearchDialog();
mViewManager->showJournalView();
mNavigator->slotDaySelect( jour->dtStart().date() );
}
void CalendarView::editTodo( Todo *todo )
{
if ( !todo ) return;
if ( todo->isReadOnly() ) {
showTodo( todo );
return;
}
- mTodoEditor->editTodo( todo ,mFlagEditDescription);
showTodoEditor();
+ mTodoEditor->editTodo( todo ,mFlagEditDescription);
}
KOEventViewerDialog* CalendarView::getEventViewerDialog()
{
if ( !mEventViewerDialog ) {
mEventViewerDialog = new KOEventViewerDialog(this);
connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) );
connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig()));
connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)),
dateNavigator(), SLOT( selectWeek( const QDate & ) ) );
connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ),
viewManager(), SLOT( showAgendaView( bool ) ) );
mEventViewerDialog->resize( 640, 480 );
}
return mEventViewerDialog;
}
void CalendarView::showEvent(Event *event)
{
getEventViewerDialog()->setEvent(event);
getEventViewerDialog()->showMe();
}
void CalendarView::showTodo(Todo *event)
{
getEventViewerDialog()->setTodo(event);
getEventViewerDialog()->showMe();
}
void CalendarView::showJournal( Journal *jour )
{
getEventViewerDialog()->setJournal(jour);
getEventViewerDialog()->showMe();
}
// void CalendarView::todoModified (Todo *event, int changed)
// {
// // if (mDialogList.find (event) != mDialogList.end ()) {
// // kdDebug() << "Todo modified and open" << endl;
// // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event];
// // temp->modified (changed);
// // }
// mViewManager->updateView();
// }
void CalendarView::appointment_show()
diff --git a/qtcompat/qinputdialog.cpp b/qtcompat/qinputdialog.cpp
index 770b281..64c581e 100644
--- a/qtcompat/qinputdialog.cpp
+++ b/qtcompat/qinputdialog.cpp
@@ -1,85 +1,87 @@
/****************************************************************************
** $Id$
**
** Implementation of QInputDialog class
**
** Created : 991212
**
** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
**
** This file is part of the dialogs module of the Qt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.QPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
** licenses may use this file in accordance with the Qt Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about Qt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for QPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
+//Edited Lutz Rogowski 2004-12-13
+
#include "qinputdialog.h"
#include <qlayout.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qspinbox.h>
#include <qcombobox.h>
#include <qwidgetstack.h>
#include <qvalidator.h>
#include <qapplication.h>
class QInputDialogPrivate
{
public:
friend class QInputDialog;
QLineEdit *lineEdit;
QSpinBox *spinBox;
QComboBox *comboBox, *editComboBox;
QPushButton *ok;
QWidgetStack *stack;
QInputDialog::Type type;
};
/*!
\class QInputDialog qinputdialog.h
\brief A convenience dialog to get a simple input from the user
\ingroup dialogs
The QInputDialog is a simple dialog which can be used if you
need a simple input from the user. This can be text, a number or
an item from a list. Also a label has to be set to tell the user
what he/she should input.
In this Qt version only the 4 static convenience functions
getText(), getInteger(), getDouble() and getItem() of QInputDialog
are available.
Use it like this:
\code
bool ok = FALSE;
QString text = QInputDialog::getText( tr( "Make an input" ), tr( "Please enter your name" ), QString::null, &ok, this );
if ( ok && !text.isEmpty() )
;// user entered something and pressed ok
else
;// user entered nothing or pressed cancel
\endcode
@@ -408,88 +410,93 @@ double QInputDialog::getDouble( const QString &caption, const QString &label, do
delete dlg;
return result;
}
/*!
Static convenience function to let the user select an item from a string list. \a caption is the text
which is displayed in the title bar of the dialog. \a label is the text which
is shown to the user (it should mention to the user what he/she should input), \a list the
string list which is inserted into the combobox, \a current the number of the item which should
be initially the current item, \a editable specifies if the combobox should be editable (if it is TRUE)
or read-only (if \a editable is FALSE), \a ok a pointer to
a bool which will be (if not 0!) set to TRUE if the user pressed ok or to FALSE if the
user pressed cancel, \a parent the parent widget of the dialog and \a name
the name of it. The dialogs pops up modally!
This method returns the text of the current item, or if \a editable was TRUE, the current
text of the combobox.
You will use this static method like this:
\code
QStringList lst;
lst << "First" << "Second" << "Third" << "Fourth" << "Fifth";
bool ok = FALSE;
QString res = QInputDialog::getItem( tr( "Please select an item" ), lst, 1, TRUE, &ok, this );
if ( ok )
;// user selected an item and pressed ok
else
;// user pressed cancel
\endcode
*/
QString QInputDialog::getItem( const QString &caption, const QString &label, const QStringList &list,
int current, bool editable,
bool *ok, QWidget *parent, const char *name )
{
QInputDialog *dlg = new QInputDialog( label, parent, name, TRUE, editable ? EditableComboBox : ComboBox );
dlg->setCaption( caption );
if ( editable ) {
dlg->editableComboBox()->insertStringList( list );
dlg->editableComboBox()->setCurrentItem( current );
} else {
dlg->comboBox()->insertStringList( list );
dlg->comboBox()->setCurrentItem( current );
}
bool ok_ = FALSE;
QString result;
+ int fixWid = 320;
+ if ( QApplication::desktop()->width() <= 240 ) {
+ fixWid = 230;
+ }
+ dlg->setFixedWidth( fixWid);
ok_ = dlg->exec() == QDialog::Accepted;
if ( ok )
*ok = ok_;
if ( editable )
result = dlg->editableComboBox()->currentText();
else
result = dlg->comboBox()->currentText();
delete dlg;
return result;
}
/*!
\internal
*/
void QInputDialog::textChanged( const QString &s )
{
bool on;
if ( d->lineEdit->validator() ) {
QString str = d->lineEdit->text();
int index = d->lineEdit->cursorPosition();
on = ( d->lineEdit->validator()->validate(str, index) ==
QValidator::Acceptable );
} else {
on = !s.isEmpty();
}
d->ok->setEnabled( on );
}
/*!
\internal
*/
void QInputDialog::tryAccept()
{
if ( !d->lineEdit->text().isEmpty() )
accept();
}