author | zautrix <zautrix> | 2005-10-22 14:12:43 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-10-22 14:12:43 (UTC) |
commit | a72d70beb381b9cd6f2af301b52ca82cdcafb299 (patch) (side-by-side diff) | |
tree | f5b068e80395821abb5717fb07757a17d805f770 | |
parent | a72f3f3acfac791715a1c512fc4cc4c3facdbb62 (diff) | |
download | kdepimpi-a72d70beb381b9cd6f2af301b52ca82cdcafb299.zip kdepimpi-a72d70beb381b9cd6f2af301b52ca82cdcafb299.tar.gz kdepimpi-a72d70beb381b9cd6f2af301b52ca82cdcafb299.tar.bz2 |
fix
-rw-r--r-- | kaddressbook/kabcore.cpp | 6 | ||||
-rw-r--r-- | microkde/kapplication.cpp | 4 | ||||
-rw-r--r-- | microkde/kdeui/ktoolbar.cpp | 14 | ||||
-rw-r--r-- | microkde/kdeui/ktoolbar.h | 4 |
4 files changed, 23 insertions, 5 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 4e2523e..033e537 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -819,112 +819,116 @@ void KABCore::mailVCard( const QStringList& uids ) 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->repaint(); } void KABCore::resizeEvent(QResizeEvent* e ) { - if ( !mMiniSplitter ) + if ( !mMiniSplitter ) { + QWidget::resizeEvent( e ); return; + } +#ifndef DESKTOP_VERSION static int desktop_width = 0; //qDebug("KABCore::resizeEvent %d %d ",desktop_width,QApplication::desktop()->width() ); if ( desktop_width != QApplication::desktop()->width() ) if ( QApplication::desktop()->width() >= 480 ) { if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480 //qDebug("640 "); if ( mMiniSplitter->orientation() == Qt::Vertical ) { //qDebug("switch V->H "); mMiniSplitter->setOrientation( Qt::Horizontal); mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); } if ( QApplication::desktop()->width() <= 640 ) { bool shot = mMainWindow->isVisible(); mMainWindow->showMinimized(); //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); mViewManager->getFilterAction()->setComboWidth( 150 ); if ( mIncSearchWidget ) mIncSearchWidget->setSize(); if ( shot ) QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); } } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640 //qDebug("480 "); if ( mMiniSplitter->orientation() == Qt::Horizontal ) { //qDebug("switch H->V "); mMiniSplitter->setOrientation( Qt::Vertical ); mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); } if ( QApplication::desktop()->width() <= 640 ) { //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); bool shot = mMainWindow->isVisible(); mMainWindow->showMinimized(); if ( KABPrefs::instance()->mHideSearchOnSwitch ) { if ( mIncSearchWidget ) { mIncSearchWidget->setSize(); } } else { mViewManager->getFilterAction()->setComboWidth( 0 ); } if ( shot ) QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); } } } desktop_width = QApplication::desktop()->width(); +#endif QWidget::resizeEvent( e ); } 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(); KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, KPimGlobalPrefs::instance()->mEx2PhoneConnection, KPimGlobalPrefs::instance()->mEx2PhoneModel ); diff --git a/microkde/kapplication.cpp b/microkde/kapplication.cpp index f36c5ae..d7c12bb 100644 --- a/microkde/kapplication.cpp +++ b/microkde/kapplication.cpp @@ -22,71 +22,73 @@ QString KApplication::randomString(int length) { if (length <=0 ) return QString::null; QString str; while (length--) { int r=random() % 62; r+=48; if (r>57) r+=7; if (r>90) r+=6; str += char(r); // so what if I work backwards? } return str; } int KApplication::execDialog( QDialog* d ) { if (QApplication::desktop()->width() <= 640 ) d->showMaximized(); else ;//d->resize( 800, 600 ); return d->exec(); } void KApplication::showLicence() { KApplication::showFile( "KDE-Pim/Pi licence", "kdepim/licence.txt" ); } void KApplication::testCoords( int* x, int* y, int* wid, int * hei ) { int dWid = QApplication::desktop()->width() ; int dHei = QApplication::desktop()->height(); + if ( *x < 0 ) *x = 0; + if ( *y < 20 ) *y = 20 ; if ( *x + *wid > dWid ) { *x = 0; if ( *wid > dWid ) *wid = dWid; } if ( *y + *hei > dHei ) { - *y = 0; + *y = 20; if ( *hei > dHei ) *hei = dHei; } } void KApplication::showFile(QString caption, QString fn) { QString text; QString fileName; #ifndef DESKTOP_VERSION fileName = getenv("QPEDIR"); fileName += "/pics/" + fn ; #else fileName = qApp->applicationDirPath () + "/" + fn; #endif QFile file( fileName ); if (!file.open( IO_ReadOnly ) ) { return ; } QTextStream ts( &file ); text = ts.read(); file.close(); KApplication::showText( caption, text ); } bool KApplication::convert2latin1(QString fileName) { QString text; QFile file( fileName ); if (!file.open( IO_ReadOnly ) ) { return false; diff --git a/microkde/kdeui/ktoolbar.cpp b/microkde/kdeui/ktoolbar.cpp index df2aad8..027e5e9 100644 --- a/microkde/kdeui/ktoolbar.cpp +++ b/microkde/kdeui/ktoolbar.cpp @@ -226,64 +226,66 @@ KToolBar::KToolBar( QMainWindow *parentWindow, QMainWindow::ToolBarDock dock, bo #endif { init( readConfig, honorStyle ); } KToolBar::KToolBar( QMainWindow *parentWindow, QWidget *dock, bool newLine, const char *name, bool honorStyle, bool readConfig ) #ifdef DESKTOP_VERSION : QToolBar( QString::fromLatin1( name ), parentWindow, dock, newLine, name ? name : "mainToolBar") #else : QPEToolBar( parentWindow,QString::fromLatin1( name )) #endif { init( readConfig, honorStyle ); } KToolBar::~KToolBar() { inshutdownprocess = true; emit toolbarDestroyed(); delete d; } void KToolBar::init( bool readConfig, bool honorStyle ) { + sizeHintW = 240; + sizeHintH = 22; inshutdownprocess = false; d = new KToolBarPrivate; setFullSize( TRUE ); d->m_honorStyle = honorStyle; context = 0; layoutTimer = new QTimer( this ); connect( layoutTimer, SIGNAL( timeout() ), this, SLOT( rebuildLayout() ) ); connect( &(d->repaintTimer), SIGNAL( timeout() ), this, SLOT( slotRepaint() ) ); /*US if ( kapp ) { // may be null when started inside designer connect(kapp, SIGNAL(toolbarAppearanceChanged(int)), this, SLOT(slotAppearanceChanged())); // request notification of changes in icon style kapp->addKipcEventMask(KIPC::IconChanged); connect(kapp, SIGNAL(iconChanged(int)), this, SLOT(slotIconChanged(int))); } */ // finally, read in our configurable settings if ( readConfig ) slotReadConfig(); if ( mainWindow() ) connect( mainWindow(), SIGNAL( toolBarPositionChanged( QToolBar * ) ), this, SLOT( toolBarPosChanged( QToolBar * ) ) ); // Hack to make sure we recalculate our size when we dock. //US connect( this, SIGNAL(placeChanged(QDockWindow::Place)), SLOT(rebuildLayout()) ); } int KToolBar::insertButton(const QString& icon, int id, bool enabled, const QString& text, int index/*US, KInstance *_instance*/ ) @@ -1410,66 +1412,74 @@ void KToolBar::insertWidgetInternal( QWidget *w, int &index, int id ) id = id2widget.count(); id2widget.insert( id, w ); widget2id.insert( w, id ); } void KToolBar::repaintMe() { setUpdatesEnabled( true ); QToolBar::repaint( true ); qDebug(" KToolBar::repaintMe() "); } void KToolBar::showEvent( QShowEvent *e ) { rebuildLayout(); QToolBar::showEvent( e ); } void KToolBar::setStretchableWidget( QWidget *w ) { QToolBar::setStretchableWidget( w ); stretchableWidget = w; } QSizePolicy KToolBar::sizePolicy() const { if ( orientation() == Horizontal ) return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); else return QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding ); } QSize KToolBar::sizeHint() const -{ - return QToolBar::sizeHint(); +{ + QSize sh = QToolBar::sizeHint(); + //qDebug("%x KToolBar::sizeHint() %d %d ",this, QToolBar::sizeHint().width(),QToolBar::sizeHint().height() ); + if ( sh.height() <= 20 || sh.width() < 60 ) + return QSize( sizeHintW, sizeHintH ); + KToolBar* ttt = (KToolBar*) this; + ttt->sizeHintW = sh.width(); + ttt->sizeHintH = sh.height(); + return sh; + //return QToolBar::sizeHint(); #if 0 QWidget::polish(); static int iii = 0; ++iii; qDebug("++++++++ KToolBar::sizeHint() %d ", iii ); int margin = static_cast<QWidget*>(ncThis)->layout()->margin(); switch( barPos() ) { case KToolBar::Top: case KToolBar::Bottom: for ( QWidget *w = widgets.first(); w; w =widgets.next() ) { if ( w->inherits( "KToolBarSeparator" ) && !( static_cast<KToolBarSeparator*>(w)->showLine() ) ) { minSize += QSize(6, 0); } else { QSize sh = w->sizeHint(); if (!sh.isValid()) sh = w->minimumSize(); minSize = minSize.expandedTo(QSize(0, sh.height())); minSize += QSize(sh.width()+1, 0); } } /*US minSize += QSize(QApplication::style().pixelMetric( QStyle::PM_DockWindowHandleExtent ), 0); */ minSize += QSize(margin*2, margin*2); break; diff --git a/microkde/kdeui/ktoolbar.h b/microkde/kdeui/ktoolbar.h index 7a5c114..3319fa8 100644 --- a/microkde/kdeui/ktoolbar.h +++ b/microkde/kdeui/ktoolbar.h @@ -1052,57 +1052,59 @@ public: * @return global setting for "Toolbars transparent when moving" */ static bool transparentSetting(); /** * @return global setting for "Icon Text" */ static IconText iconTextSetting(); public slots: virtual void setIconText( const QString &txt ) { QToolBar::setIconText( txt ); } void slotRepaint(); protected: void mousePressEvent( QMouseEvent * ); void childEvent( QChildEvent *e ); void showEvent( QShowEvent *e ); void resizeEvent( QResizeEvent *e ); bool event( QEvent *e ); void applyAppearanceSettings(KConfig *config, const QString &_configGroup, bool forceGlobal = false); QString settingsGroup(); private slots: void rebuildLayout(); void slotReadConfig (); void slotAppearanceChanged(); void slotIconChanged(int); void toolBarPosChanged( QToolBar *tb ); void slotContextAboutToShow(); void widgetDestroyed(); -private: +private: + int sizeHintW; + int sizeHintH; void init( bool readConfig = true, bool honorStyle = false ); void doConnections( KToolBarButton *button ); void insertWidgetInternal( QWidget *w, int &index, int id ); void removeWidgetInternal( QWidget *w ); void getAttributes( QString &position, QString &icontext, int &index ); //US KPopupMenu *contextMenu(); QPopupMenu *contextMenu(); QMap<QWidget*, int > widget2id; typedef QMap<int, QWidget* > Id2WidgetMap; Id2WidgetMap id2widget; //US KPopupMenu *context; QPopupMenu *context; QPtrList<QWidget> widgets; QTimer *layoutTimer; QGuardedPtr<QWidget> stretchableWidget, rightAligned; protected: virtual void virtual_hook( int id, void* data ); private: KToolBarPrivate *d; bool inshutdownprocess; }; #endif |