summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2007-06-05 13:21:33 (UTC)
committer zautrix <zautrix>2007-06-05 13:21:33 (UTC)
commitd5c53970b9e12bfe774d1fecd603080aded24e09 (patch) (side-by-side diff)
treefca3c555b3e37302ebe1ee1840fa3e27502dcc50
parenta388f4f019ccf2b7c138a6814b44b9e8f2a5f570 (diff)
downloadkdepimpi-d5c53970b9e12bfe774d1fecd603080aded24e09.zip
kdepimpi-d5c53970b9e12bfe774d1fecd603080aded24e09.tar.gz
kdepimpi-d5c53970b9e12bfe774d1fecd603080aded24e09.tar.bz2
print fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kolistview.cpp22
-rw-r--r--libkdepim/kcmconfigs/kdepimconfigwidget.cpp6
2 files changed, 26 insertions, 2 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index b378330..192f8c0 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -1153,286 +1153,306 @@ void KOListView::allSelection()
mListView->selectAll( true );
}
void KOListView::clear()
{
mListView->clear();
mUidDict.clear();
}
Incidence* KOListView::currentItem()
{
if ( mListView->currentItem() )
return ((KOListViewItem*) mListView->currentItem())->data();
return 0;
}
void KOListView::keyPressEvent ( QKeyEvent *e)
{
if ( e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace ) {
deleteAll();
return;
}
e->ignore();
}
void KOListViewListView::keyPressEvent ( QKeyEvent *e)
{
switch ( e->key() ) {
case Qt::Key_Down:
if ( e->state() == ShiftButton ) {
QListViewItem* cn = currentItem();
if ( !cn )
cn = firstChild();
if ( !cn )
return;
while ( cn->nextSibling() )
cn = cn->nextSibling();
setCurrentItem ( cn );
ensureItemVisible ( cn );
e->accept();
return;
}
if ( e->state() == ControlButton ) {
int count = childCount ();
int jump = count / 5;
QListViewItem* cn;
cn = currentItem();
if ( ! cn )
return;
if ( jump == 0 )
jump = 1;
while ( jump && cn->nextSibling() ) {
cn = cn->nextSibling();
--jump;
}
setCurrentItem ( cn );
ensureItemVisible ( cn );
} else
QListView::keyPressEvent ( e ) ;
e->accept();
break;
case Qt::Key_Up:
if ( e->state() == ShiftButton ) {
QListViewItem* cn = firstChild();
if ( cn ) {
setCurrentItem ( cn );
ensureItemVisible ( cn );
}
e->accept();
return;
}
if ( e->state() == ControlButton ) {
int count = childCount ();
int jump = count / 5;
QListViewItem* cn;
cn = currentItem();
if ( ! cn )
return;
if ( jump == 0 )
jump = 1;
while ( jump && cn->itemAbove ()) {
cn = cn->itemAbove ();
--jump;
}
setCurrentItem ( cn );
ensureItemVisible ( cn );
} else
QListView::keyPressEvent ( e ) ;
e->accept();
break;
case Qt::Key_I: {
QListViewItem* cn;
cn = currentItem();
if ( cn ) {
KOListViewItem* ci = (KOListViewItem*)( cn );
if ( ci ){
//emit showIncidence( ci->data());
cn = cn->nextSibling();
if ( cn ) {
setCurrentItem ( cn );
ensureItemVisible ( cn );
}
emit showIncidence( ci->data());
}
}
e->accept();
}
break;
case Qt::Key_Return:
case Qt::Key_Enter:
{
QListViewItem* cn;
cn = currentItem();
if ( cn ) {
KOListViewItem* ci = (KOListViewItem*)( cn );
if ( ci ){
if ( e->state() == ShiftButton )
ci->setSelected( false );
else
ci->setSelected( true );
cn = cn->nextSibling();
if ( cn ) {
setCurrentItem ( cn );
ensureItemVisible ( cn );
} else {
emit currentChanged( ci );
}
}
}
e->accept();
}
break;
default:
e->ignore();
}
}
KOListViewListView::KOListViewListView(KOListView * lv )
: KListView( lv, "kolistlistview", false )
{
mYMousePos = 0;
setAllColumnsShowFocus( true );
mPopupTimer = new QTimer(this);
connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu()));
#ifndef DESKTOP_VERSION
//QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold );
#endif
setSelectionMode( QListView::Multi );
setMultiSelection( true);
}
bool KOListViewListView::hasMultiSelection(QListViewItem* item)
{
QListViewItem *qitem = firstChild ();
while ( qitem ) {
if ( qitem->isSelected() && item != qitem )
return true;
qitem = qitem->nextSibling();
}
return false;
}
void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e)
{
if (!e) return;
QPoint vp = contentsToViewport(e->pos());
QListViewItem *item = itemAt(vp);
if (!item) {
emit newEvent();
return;
}
KListView::contentsMouseDoubleClickEvent(e);
}
#if 0
void KOListViewListView::contentsMousePressEvent(QMouseEvent *e)
{
//qDebug("contentsMousePressEvent++++ ");
KListView::contentsMousePressEvent( e );
if ( e->button() == RightButton ) {
QListViewItem* ci = currentItem();
clearSelection () ;
if ( ci )
ci->setSelected( true );
}
}
void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e)
{
KListView::contentsMouseReleaseEvent(e);
}
void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e)
{
KListView::contentsMouseMoveEvent(e);
}
#endif
void KOListViewListView::popupMenu()
{
mPopupTimer->stop();
QMouseEvent* e = new QMouseEvent( QEvent::MouseButtonPress, mEventPos ,mEventGlobalPos, RightButton , RightButton );
QApplication::postEvent( this->viewport(), e );
}
void KOListViewListView::contentsMousePressEvent(QMouseEvent *e)
{
//qDebug("contentsMousePressEvent++++ %d %d", e->pos().y(), e->globalPos().y());
mYMousePos = mapToGlobal( (e->pos())).y();
if ( e->button() == LeftButton ) {
mPopupTimer->start( 600 );
mEventPos = contentsToViewport(e->pos());
mEventGlobalPos = e->globalPos();
}
KListView::contentsMousePressEvent( e );
if ( e->button() == RightButton ) {
QListViewItem* ci = currentItem();
//clearSelection();
if ( ci )
ci->setSelected( true );
}
}
void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e)
{
mPopupTimer->stop();
KListView::contentsMouseReleaseEvent(e);
}
void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e)
{
// qDebug("contentsMouseMoveEv....... ");
// qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() );
int diff = mYMousePos - mapToGlobal( (e->pos())).y();
if ( diff < 0 ) diff = -diff;
if ( diff > 15 )
mPopupTimer->stop();
else {
mEventPos = contentsToViewport(e->pos());
mEventGlobalPos = e->globalPos();
}
KListView::contentsMouseMoveEvent(e);
}
#define protected public
#include <qheader.h>
#undef protected
void KOListViewListView::printList()
{
#ifdef DESKTOP_VERSION
KOPrintPrefs pp ( this );
if (!pp.exec() )
return;
int scaleval = pp.printMode() ;
QPrinter printer;
if (!printer.setup() )
return;
clearSelection ();
QPainter p;
p.begin ( &printer );
+ p.setFont(font());
QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer );
float dx, dy;
int wid = (m.width() * 9)/10;
dx = (float) wid/(float)contentsWidth ();
dy = (float)(m.height()) / (float)contentsHeight ();
float scale;
// scale to fit the width or height of the paper
if ( dx < dy )
scale = dx;
else
scale = dy;
p.translate( m.width()/10,m.width()/10 );
if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) {
p.scale( scale, scale );
}
int cou = header()->count();
int iii;
QRect rect ( 0,0,0, header()->height());
for ( iii = 0; iii < cou; ++iii ) {
rect.setLeft ( header()->sectionPos( iii ) );
rect.setRight ( header()->sectionPos( iii ) + header()->sectionSize (iii));
header()->paintSection ( & p, header()->mapToIndex (iii), rect );
}
p.translate( 0, header()->height());
- drawContentsOffset ( &p, 0,0, 0,0, contentsWidth (), contentsHeight () );
+ //drawContentsOffset ( &p, 0,0, 0,0, contentsWidth (), contentsHeight () );
+
+ const QColorGroup &cg = colorGroup();
+ KOListViewItem* item = (KOListViewItem* )firstChild();
+ int yOff = 0;
+ while ( item ) {
+ p.translate( 0, yOff );
+ p.save();
+ for ( iii = 0; iii < cou; ++iii ) {
+ int align = columnAlignment( iii );
+ if ( align == AlignAuto ) align = AlignLeft;
+ p.restore();
+ p.save();
+ p.translate( header()->sectionPos( iii ), 0);
+ item->paintCell( &p, cg, iii, header()->sectionSize (iii), align );
+ }
+ yOff = item->height();
+ item = (KOListViewItem* )(item->itemBelow());
+ p.restore();
+ }
p.end();
#endif
}
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
index 764c495..292951b 100644
--- a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
+++ b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
@@ -672,336 +672,340 @@ void KDEPIMConfigWidget::saveEditFieldSettings()
mSMSOtherChannel = mChannel->text();
mSMSOtherMessage = mMessage->text();
mSMSOtherMessageParameters = mParameters->text();
}
else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC))
{
mFaxOtherChannel = mChannel->text();
mFaxOtherMessage = mMessage->text();
mFaxOtherMessageParameters = mParameters->text();
}
else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC))
{
mPagerOtherChannel = mChannel->text();
mPagerOtherMessage = mMessage->text();
mPagerOtherMessageParameters = mParameters->text();
}
else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC))
{
mSipOtherChannel = mChannel->text();
mSipOtherMessage = mMessage->text();
mSipOtherMessageParameters = mParameters->text();
}
}
void KDEPIMConfigWidget::updateClientWidgets()
{
bool blocked = signalsBlocked();
blockSignals( true );
// at this point we assume, that mCurrentApp and mCurrentClient are set to the values that we want to display
QMap<ExternalAppHandler::Types, QString>::Iterator it = mExternalAppsMap.find ( mCurrentApp );
if (it == mExternalAppsMap.end())
return;
// update group box
mExternalAppGroupBox->setTitle(i18n( "Used %1 Client" ).arg(it.data()));
//update the entries in the client combobox
mClient->clear();
QList<DefaultAppItem> items = ExternalAppHandler::instance()->getAvailableDefaultItems(mCurrentApp);
DefaultAppItem* dai;
for ( dai=items.first(); dai != 0; dai=items.next() )
{
mClient->insertItem( i18n(dai->_label), dai->_id );
if (dai->_id == mCurrentClient)
{
//restore the edit fields with the data of the local membervariables if we had set it to "other".
//Otherwise take the default data from externalapphandler.
mChannel->setText(dai->_channel);
mMessage->setText(dai->_message);
mParameters->setText(dai->_parameters);
if ( mMessage2 )
mMessage2->setText(dai->_message2);
if ( mParameters2 )
mParameters2->setText(dai->_parameters2);
if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC))
{
mChannel->setText(mEmailOtherChannel);
mMessage->setText(mEmailOtherMessage);
mParameters->setText(mEmailOtherMessageParameters);
if ( mMessage2 )
mMessage2->setText(mEmailOtherMessage2);
if ( mParameters2 )
mParameters2->setText(mEmailOtherMessageParameters2);
}
else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC))
{
mChannel->setText(mPhoneOtherChannel);
mMessage->setText(mPhoneOtherMessage);
mParameters->setText(mPhoneOtherMessageParameters);
}
else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC))
{
mChannel->setText(mSMSOtherChannel);
mMessage->setText(mSMSOtherMessage);
mParameters->setText(mSMSOtherMessageParameters);
}
else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC))
{
mChannel->setText(mFaxOtherChannel);
mMessage->setText(mFaxOtherMessage);
mParameters->setText(mFaxOtherMessageParameters);
}
else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC))
{
mChannel->setText(mPagerOtherChannel);
mMessage->setText(mPagerOtherMessage);
mParameters->setText(mPagerOtherMessageParameters);
}
else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC))
{
mChannel->setText(mSipOtherChannel);
mMessage->setText(mSipOtherMessage);
mParameters->setText(mSipOtherMessageParameters);
}
}
}
bool readonly;
bool enabled;
if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC))
||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC))
||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC))
||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC))
||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC))
||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)))
{
readonly = false;
}
else
{
readonly = true;
}
if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::NONE_EMC))
||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::NONE_PHC))
||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::NONE_SMC))
||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::NONE_FAC))
||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::NONE_PAC))
||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::NONE_SIC)))
{
enabled = false;
}
else
{
enabled = true;
}
mChannel->setReadOnly(readonly);
mMessage->setReadOnly(readonly);
mParameters->setReadOnly(readonly);
if ( mMessage2 )
mMessage2->setReadOnly(readonly);
if ( mParameters2 )
mParameters2->setReadOnly(readonly);
mChannel->setEnabled(enabled);
mMessage->setEnabled(enabled);
mParameters->setEnabled(enabled);
if ( mMessage2 )
mMessage2->setEnabled(enabled);
if ( mParameters2 )
mParameters2->setEnabled(enabled);
mClient->setCurrentItem(mCurrentClient);
// enable/disable the extra message/parameter field
if (mCurrentApp == ExternalAppHandler::EMAIL)
{
}
else
{
if ( mMessage2 )
mMessage2->setText( "" );
if ( mParameters2 )
mParameters2->setText( "" );
}
if (enabled == true) {
if ( mMessage2 )
mMessage2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL);
if ( mParameters2 )
mParameters2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL);
}
blockSignals( blocked );
}
void KDEPIMConfigWidget::usrReadConfig()
{
KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance();
bool blocked = signalsBlocked();
blockSignals( true );
if (KPimGlobalPrefs::instance()->mBackupUseDefaultDir )
mBackupUrl->setURL( KGlobalSettings::backupDataDir() );
else {
mBackupUrl->setURL(prefs->mBackupDatadir);
}
mBackupNumbersSpin->setValue( prefs->mBackupNumbers );
mBackupDayCountSpin->setValue( prefs->mBackupDayCount);
QString dummy = prefs->mUserDateFormatLong;
mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") ));
dummy = prefs->mUserDateFormatShort;
mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") ));
QDate current ( 2001, 1,1);
mStartDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingStart-1));
mEndDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingEnd-1));
setCombo(mTimeZoneCombo,i18n(prefs->mTimeZoneId));
mEmailClient = prefs->mEmailClient;
mEmailOtherChannel = prefs->mEmailOtherChannel;
mEmailOtherMessage = prefs->mEmailOtherMessage;
mEmailOtherMessageParameters = prefs->mEmailOtherMessageParameters;
mEmailOtherMessage2 = prefs->mEmailOtherMessage2;
mEmailOtherMessageParameters2 = prefs->mEmailOtherMessageParameters2;
mPhoneClient = prefs->mPhoneClient;
mPhoneOtherChannel = prefs->mPhoneOtherChannel;
mPhoneOtherMessage = prefs->mPhoneOtherMessage;
mPhoneOtherMessageParameters = prefs->mPhoneOtherMessageParameters;
mFaxClient = prefs->mFaxClient;
mFaxOtherChannel = prefs->mFaxOtherChannel;
mFaxOtherMessage = prefs->mFaxOtherMessage;
mFaxOtherMessageParameters = prefs->mFaxOtherMessageParameters;
mSMSClient = prefs->mSMSClient;
mSMSOtherChannel = prefs->mSMSOtherChannel;
mSMSOtherMessage = prefs->mSMSOtherMessage;
mSMSOtherMessageParameters = prefs->mSMSOtherMessageParameters;
mPagerClient = prefs->mPagerClient;
mPagerOtherChannel = prefs->mPagerOtherChannel;
mPagerOtherMessage = prefs->mPagerOtherMessage;
mPagerOtherMessageParameters = prefs->mPagerOtherMessageParameters;
mSipClient = prefs->mSipClient;
mSipOtherChannel = prefs->mSipOtherChannel;
mSipOtherMessage = prefs->mSipOtherMessage;
mSipOtherMessageParameters = prefs->mSipOtherMessageParameters;
mCurrentApp = ExternalAppHandler::EMAIL;
mCurrentClient = mEmailClient;
updateClientWidgets();
blockSignals( blocked );
}
void KDEPIMConfigWidget::usrWriteConfig()
{
KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance();
saveEditFieldSettings();
prefs->mBackupNumbers = mBackupNumbersSpin->value();
prefs->mBackupDayCount = mBackupDayCountSpin->value();
- prefs->mBackupDatadir = mBackupUrl->url();
+ QString bup_url = mBackupUrl->url();
+ if ( bup_url.right(1) != "/" && bup_url.right(1) != "\\" )
+ bup_url += "/";
+
+ prefs->mBackupDatadir = bup_url;
prefs->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") );
prefs->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") );
prefs->mTimeZoneId = mTimeZoneCombo->currentText();
QDate date;
date = mStartDateSavingEdit->date();
int sub = 0;
if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 )
sub = 1;
prefs->mDaylightsavingStart = date.dayOfYear()-sub;
date = mEndDateSavingEdit->date();
if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 )
sub = 1;
else
sub = 0;
prefs->mDaylightsavingEnd = date.dayOfYear()-sub;
prefs->mEmailClient = mEmailClient;
prefs->mEmailOtherChannel = mEmailOtherChannel;
prefs->mEmailOtherMessage = mEmailOtherMessage;
prefs->mEmailOtherMessageParameters = mEmailOtherMessageParameters;
prefs->mEmailOtherMessage2 = mEmailOtherMessage2;
prefs->mEmailOtherMessageParameters2 = mEmailOtherMessageParameters2;
prefs->mPhoneClient = mPhoneClient;
prefs->mPhoneOtherChannel = mPhoneOtherChannel;
prefs->mPhoneOtherMessage = mPhoneOtherMessage;
prefs->mPhoneOtherMessageParameters = mPhoneOtherMessageParameters;
prefs->mFaxClient = mFaxClient;
prefs->mFaxOtherChannel = mFaxOtherChannel;
prefs->mFaxOtherMessage = mFaxOtherMessage;
prefs->mFaxOtherMessageParameters = mFaxOtherMessageParameters;
prefs->mSMSClient = mSMSClient;
prefs->mSMSOtherChannel = mSMSOtherChannel;
prefs->mSMSOtherMessage = mSMSOtherMessage;
prefs->mSMSOtherMessageParameters = mSMSOtherMessageParameters;
prefs->mPagerClient = mPagerClient;
prefs->mPagerOtherChannel = mPagerOtherChannel;
prefs->mPagerOtherMessage = mPagerOtherMessage;
prefs->mPagerOtherMessageParameters = mPagerOtherMessageParameters;
prefs->mSipClient = mSipClient;
prefs->mSipOtherChannel = mSipOtherChannel;
prefs->mSipOtherMessage = mSipOtherMessage;
prefs->mSipOtherMessageParameters = mSipOtherMessageParameters;
//release the cache that other views can access the changed values instantanious
ExternalAppHandler::instance()->loadConfig();
KPimGlobalPrefs::instance()->setGlobalConfig();
}
void KDEPIMConfigWidget::setCombo(QComboBox *combo, const QString & text,
const QStringList *tags)
{
if (tags) {
int i = tags->findIndex(text);
if (i > 0) combo->setCurrentItem(i);
} else {
for(int i=0;i<combo->count();++i) {
if (combo->text(i) == text) {
combo->setCurrentItem(i);
break;
}
}
}
}
void KDEPIMConfigWidget::textChanged( const QString& text )
{
emit changed( true );
}