[pkg-kde-commits] rev 2695 - trunk/packages/kdesdk/debian/patches
Christopher Martin
chrsmrtn at costa.debian.org
Wed Dec 21 13:42:38 UTC 2005
Author: chrsmrtn
Date: 2005-12-21 13:42:37 +0000 (Wed, 21 Dec 2005)
New Revision: 2695
Added:
trunk/packages/kdesdk/debian/patches/01_kdesdk_branch_r490305.diff
Log:
kdesdk branch pull for 3.5.
Added: trunk/packages/kdesdk/debian/patches/01_kdesdk_branch_r490305.diff
===================================================================
--- trunk/packages/kdesdk/debian/patches/01_kdesdk_branch_r490305.diff 2005-12-21 01:43:33 UTC (rev 2694)
+++ trunk/packages/kdesdk/debian/patches/01_kdesdk_branch_r490305.diff 2005-12-21 13:42:37 UTC (rev 2695)
@@ -0,0 +1,1425 @@
+#DPATCHLEVEL=0
+--- kbabel/catalogmanager/catalogmanagerview.cpp (revision 486002)
++++ kbabel/catalogmanager/catalogmanagerview.cpp (revision 490305)
+@@ -69,8 +69,8 @@
+ #include <kio/netaccess.h>
+ #include <kprogress.h>
+ #include <kwin.h>
+-#include <ktar.h>
+ #include <kdeversion.h>
++#include <ktempfile.h>
+
+ #include <qfileinfo.h>
+ #include <qdir.h>
+@@ -511,52 +511,90 @@
+
+ void CatalogManagerView::saveMarks()
+ {
+- const KURL url = KFileDialog::getSaveURL( QString(), "*.marklist", this );
+- if( url.isEmpty() ) return;
++ const KURL url2 = KFileDialog::getSaveURL( QString(), "*.marklist", this );
++ if( url2.isEmpty() ) return;
+
+- if ( KIO::NetAccess::exists( url, false, this ) )
++ // ### FIXME: why is the file dialog not doing this?
++ if ( KIO::NetAccess::exists( url2, false, this ) )
+ {
+ if(KMessageBox::warningContinueCancel(this,QString("<qt>%1</qt>").arg(i18n("The file %1 already exists. "
+- "Do you want to overwrite it?").arg(url.prettyURL())),i18n("Warning"),i18n("&Overwrite"))==KMessageBox::Cancel)
++ "Do you want to overwrite it?").arg(url2.prettyURL())),i18n("Warning"),i18n("&Overwrite"))==KMessageBox::Cancel)
+ {
+ return;
+ }
+ }
+
+- QString filename;
+- if( url.isLocalFile() ) filename=url.path(0);
+- else filename=kapp->tempSaveName( url.path(0) );
++#if KDE_IS_VERSION( 3, 4, 92 )
++ // Support for partially remote KIO slave like media:
++ const KURL url ( KIO::NetAccess::mostLocalURL( url2, this ) );
++#else
++ const KURL url ( url2 );
++#endif
++ kdDebug() << "Saving marks: " << url2.prettyURL() << " most-local: " << url.prettyURL() << endl;
++
++ QFile* file = 0;
++ KTempFile* tempFile = 0;
++ QTextStream* stream = 0;
++ bool error = false;
+
+- bool error=false;
+-
+- QFile f(filename);
+- if( f.open(IO_WriteOnly) )
++ const bool localFile = url.isLocalFile();
++ if ( localFile )
+ {
+- QTextStream s( &f );
+- s << "[Markers]" << endl;
+- for( QStringList::const_iterator it = _markerList.constBegin(); it!=_markerList.constEnd() ; ++it )
+- s << (*it) << endl;
+- f.close();
++ // We have a local file
++ file = new QFile( url.path() );
++ if ( file->open (IO_WriteOnly) )
++ {
++ stream = new QTextStream( file );
++ }
++ else
++ {
++ error = true;
++ }
+ }
+ else
+ {
+- error=true;
+- KMessageBox::error(this,
+- i18n("An error occurred while trying to write to file:\n%1\n").arg(url.prettyURL()));
++ tempFile = new KTempFile();
++ tempFile->setAutoDelete(true);
++ stream = tempFile->textStream();
++ error = !stream;
+ }
++ if ( !error )
++ {
++ // ### TODO: try to get a better file format for KDE4 (XML?), one working with real relative paths (no / at start) and working with UTF-8
++ *stream << "[Markers]" << endl;
++ for( QStringList::const_iterator it = _markerList.constBegin(); it!=_markerList.constEnd() ; ++it )
++ *stream << (*it) << endl;
++ }
++ if ( error )
++ {
++ // ### KDE4 FIXME: strip the final \n of the message
++ KMessageBox::error( this,
++ i18n( "An error occurred while trying to write to file:\n%1\n" ).arg( url.prettyURL()) );
++ }
++ else if ( !localFile )
++ {
++ tempFile->close();
++ if( !KIO::NetAccess::upload( tempFile->name(), url, this ) )
++ {
++ // ### KDE4 FIXME: strip the final \n of the message
++ KMessageBox::error(this,
++ i18n("An error occurred while trying to upload the file:\n%1\n").arg(url.prettyURL()));
++ }
++ }
+
+- if( !error && !url.isLocalFile())
++ // We have finished so clean up
++ if ( localFile )
+ {
+- if( !KIO::NetAccess::upload( filename, url ) )
+- {
+- KMessageBox::error(this,
+- i18n("An error occurred while trying to upload the file:\n%1\n").arg(url.prettyURL()));
+- }
++ delete stream;
++ file->close();
++ delete file;
+ }
+-
+- if( !url.isLocalFile() ) QFile::remove(filename);
+-
+- checkSelected();
++ else
++ {
++ delete tempFile;
++ }
++
++ checkSelected();
+ }
+
+ void CatalogManagerView::slotMarkPattern( )
+--- umbrello/umbrello/codegenerators/tclwriter.cpp (revision 486002)
++++ umbrello/umbrello/codegenerators/tclwriter.cpp (revision 490305)
+@@ -217,7 +217,7 @@
+ }
+ // check on enum classes
+ if (!classifierInfo->isInterface) {
+- // use tcl-list for enum´s
++ // use tcl-list for enum's
+ if (c->getBaseType() == Uml::ot_Enum) {
+ UMLClassifierListItemList litList =
+ c->getFilteredList(Uml::ot_EnumLiteral);
+--- umbrello/umbrello/dialogs/assocgenpage.cpp (revision 486002)
++++ umbrello/umbrello/dialogs/assocgenpage.cpp (revision 490305)
+@@ -17,6 +17,7 @@
+
+ // qt includes
+ #include <qlayout.h>
++#include <qcombobox.h>
+
+ // kde includes
+ #include <klocale.h>
+@@ -33,7 +34,7 @@
+
+ m_pAssociationWidget = assoc;
+ m_pWidget = 0;
+- m_pTypeLE = 0;
++ m_pTypeCB = 0;
+ m_pAssocNameLE = 0;
+ m_pUmldoc = d;
+
+@@ -77,25 +78,51 @@
+ m_pDoc = new QMultiLineEdit(docGB);
+ docLayout -> addWidget(m_pDoc);
+ m_pDoc-> setText(m_pAssociationWidget-> getDoc());
++ Uml::Association_Type currentType = m_pAssociationWidget->getAssocType();
++ QString currentTypeAsString = UMLAssociation::typeAsString(currentType);
++ QLabel *pTypeL = new QLabel(i18n("Type:"), nameGB);
++ nameLayout->addWidget(pTypeL, 1, 0);
+
+- // Association Type
+- QLabel *pTypeL = NULL;
+- Dialog_Utils::makeLabeledEditField( nameGB, nameLayout, 1,
+- pTypeL, i18n("Type:"),
+- m_pTypeLE,
+- UMLAssociation::typeAsString(m_pAssociationWidget->getAssocType()) );
+- m_pTypeLE->setEnabled(false);
++ /* Here is a list of all the supported choices for changing
++ association types */
++ m_AssocTypes.clear();
++ m_AssocTypes << Uml::at_Aggregation
++ << Uml::at_Composition << Uml::at_Containment;
+
++ bool found=false;
++ m_AssocTypeStrings.clear();
++ for (int i=0; i<m_AssocTypes.size(); ++i) {
++ if (m_AssocTypes[i] == currentType) found=true;
++ QString typeStr = UMLAssociation::typeAsString(m_AssocTypes[i]);
++ m_AssocTypeStrings << typeStr;
++ }
++
++ if (!found) {
++ m_AssocTypes.clear();
++ m_AssocTypes << currentType;
++ m_AssocTypeStrings.clear();
++ m_AssocTypeStrings << currentTypeAsString;
++ }
++
++ m_pTypeCB = new QComboBox(nameGB);
++ pTypeL->setBuddy(m_pTypeCB);
++ m_pTypeCB->insertStringList(m_AssocTypeStrings);
++ m_pTypeCB->setCurrentText(currentTypeAsString);
+ m_pDoc->setWordWrap(QMultiLineEdit::WidgetWidth);
++ nameLayout->addWidget(m_pTypeCB, 1, 1);
++
+
+ }
+
+
+ void AssocGenPage::updateObject() {
+
++
+ if(m_pAssociationWidget) {
+ QString name = m_pAssocNameLE -> text();
+-
++ int comboBoxItem = m_pTypeCB->currentItem();
++ Uml::Association_Type newType = m_AssocTypes[comboBoxItem];
++ m_pAssociationWidget->setAssocType(newType);
+ m_pAssociationWidget->setName(m_pAssocNameLE->text());
+ m_pAssociationWidget->setDoc(m_pDoc->text());
+
+--- umbrello/umbrello/dialogs/settingsdlg.cpp (revision 486002)
++++ umbrello/umbrello/dialogs/settingsdlg.cpp (revision 490305)
+@@ -311,7 +311,7 @@
+ case Settings::page_UI:
+ m_UiWidgets.useFillColorCB -> setChecked( true );
+ m_UiWidgets.fillColorB -> setColor( QColor( 255, 255, 192 ) );
+- m_UiWidgets.lineColorB -> setColor( red );
++ m_UiWidgets.lineColorB -> setColor( Qt::red );
+ m_UiWidgets.lineWidthB -> setValue( 0 );
+ break;
+
+@@ -386,7 +386,7 @@
+ }
+
+ void SettingsDlg::slotLineBClicked() {
+- m_UiWidgets.lineColorB -> setColor( red );
++ m_UiWidgets.lineColorB -> setColor( Qt::red );
+ }
+
+ void SettingsDlg::slotFillBClicked() {
+--- umbrello/umbrello/dialogs/assocgenpage.h (revision 486002)
++++ umbrello/umbrello/dialogs/assocgenpage.h (revision 490305)
+@@ -24,6 +24,7 @@
+ #include <qmultilineedit.h>
+ #include <qradiobutton.h>
+ #include <qcheckbox.h>
++#include <qvaluelist.h>
+
+ //my class includes
+ #include "../umlobject.h"
+@@ -31,6 +32,9 @@
+ #include "../umldoc.h"
+ #include "../associationwidget.h"
+
++class QComboBox;
++
++
+ /**
+ * Displays properties of a UMLObject in a dialog box. This is not usually directly
+ * called. The class @ref AssocPropDlg will set this up for you.
+@@ -64,7 +68,14 @@
+ void updateObject();
+
+ private:
+- QLineEdit * m_pAssocNameLE, *m_pTypeLE;
++ QLineEdit * m_pAssocNameLE;
++ QComboBox *m_pTypeCB;
++
++ /* Choices for the QComboBox, and we store ints and strings
++ so we can translate both ways */
++ QValueList<Uml::Association_Type> m_AssocTypes;
++ QStringList m_AssocTypeStrings;
++
+ QMultiLineEdit * m_pDoc;
+
+ AssociationWidget *m_pAssociationWidget;
+--- umbrello/umbrello/umlrole.h (revision 486002)
++++ umbrello/umbrello/umlrole.h (revision 490305)
+@@ -67,20 +67,6 @@
+ QString getMultiplicity() const;
+
+ /**
+- * Returns the name assigned to the role.
+- *
+- * @return The name assigned to the role.
+- */
+- QString getName() const;
+-
+- /**
+- * Returns the documentation for the role.
+- *
+- * @return The documentation text for the role.
+- */
+- QString getDoc() const;
+-
+- /**
+ * Sets the UMLObject playing the role in the association.
+ *
+ * @param obj Pointer to the UMLObject of role.
+@@ -101,20 +87,6 @@
+ */
+ void setMultiplicity ( const QString &multi );
+
+- /**
+- * Sets the name of the role.
+- *
+- * @param roleName The name of role.
+- */
+- void setName( const QString &roleName );
+-
+- /**
+- * Sets the documentation on the role.
+- *
+- * @param doc The string with the documentation.
+- */
+- void setDoc( const QString &doc );
+-
+ UMLAssociation * getParentAssociation ();
+
+ // Sets the m_SecondaryId
+@@ -152,13 +124,10 @@
+ /** do some initialization at construction time */
+ void init (UMLAssociation * parent, UMLObject * parentObj, Uml::Role_Type r);
+
+- QString m_Doc;
+ UMLAssociation * m_pAssoc;
+ Uml::Role_Type m_role;
+- QString m_Name;
+ QString m_Multi;
+ Uml::Changeability_Type m_Changeability;
+-
+ };
+
+ #endif
+--- umbrello/umbrello/umlrole.cpp (revision 486002)
++++ umbrello/umbrello/umlrole.cpp (revision 490305)
+@@ -55,14 +55,6 @@
+ return m_Multi;
+ }
+
+-QString UMLRole::getName() const {
+- return m_Name;
+-}
+-
+-QString UMLRole::getDoc() const {
+- return m_Doc;
+-}
+-
+ void UMLRole::setObject (UMLObject *obj) {
+ // because we will get the id of this role from the parent
+ // object, we CANT allow UMLRoles to take other UMLRoles as
+@@ -89,16 +81,6 @@
+ emit modified();
+ }
+
+-void UMLRole::setName( const QString &roleName ) {
+- m_Name = roleName;
+- emit modified();
+-}
+-
+-void UMLRole::setDoc( const QString &doc ) {
+- m_Doc = doc;
+- emit modified();
+-}
+-
+ Uml::Role_Type UMLRole::getRole() {
+ return m_role;
+ }
+@@ -294,15 +276,17 @@
+ // the component roles/linked items needs to be done in order to get things
+ // right. *sigh* -b.t.
+
+- if (m_role == Uml::A) { // setting association type from the role (A)
+- QString aggregation = element.attribute("aggregation", "none");
+- if (aggregation == "composite")
+- m_pAssoc->setAssocType(Uml::at_Composition);
+- else if (aggregation == "shared")
+- m_pAssoc->setAssocType(Uml::at_Aggregation);
+- /* else
+- m_pAssoc->setAssocType(Uml::at_Association); */
+- }
++ // Setting association type from the role (A)
++ // Determination of the "aggregation" attribute used to be done only
++ // when (m_role == Uml::A) but some XMI writers (e.g. StarUML) place
++ // the aggregation attribute at role B.
++ // The role end with the aggregation unequal to "none" wins.
++ QString aggregation = element.attribute("aggregation", "none");
++ if (aggregation == "composite")
++ m_pAssoc->setAssocType(Uml::at_Composition);
++ else if (aggregation == "shared" // UML1.3
++ || aggregation == "aggregate") // UML1.4
++ m_pAssoc->setAssocType(Uml::at_Aggregation);
+
+ if (!element.hasAttribute("isNavigable")) {
+ /* Backward compatibility mode: In Umbrello version 1.3.x the
+--- umbrello/umbrello/associationwidget.cpp (revision 486002)
++++ umbrello/umbrello/associationwidget.cpp (revision 490305)
+@@ -1562,13 +1562,13 @@
+ /*
+ the distance D between points (x2, y2) and (x3, y3) has the following formula:
+
+- --- ------------------------------
+- D = \ / 2 2
+- \ / (x3 - x2) + (y3 - y2)
++ --- ------------------------------
++ D = \ / 2 2
++ \ / (x3 - x2) + (y3 - y2)
+
+ D, x2 and y2 are known and line P2P3 is perpendicular to line (x1,y1)(x2,y2), so if the
+ line P1P2 has the formula y = m*x + b,
+- then (x1 - x2)
++ then (x1 - x2)
+ m = ----------- , because it is perpendicular to line P1P2
+ (y2 - y1)
+
+@@ -1577,28 +1577,28 @@
+
+ then P3 = (x3, m*x3 + b)
+
+- 2 2 2
++ 2 2 2
+ D = (x3 - x2) + (y3 - y2)
+
+- 2 2 2 2 2
+- D = x3 - 2*x3*x2 + x2 + y3 - 2*y3*y2 + y2
++ 2 2 2 2 2
++ D = x3 - 2*x3*x2 + x2 + y3 - 2*y3*y2 + y2
+
+- 2 2 2 2 2
+- D - x2 - y2 = x3 - 2*x3*x2 + y3 - 2*y3*y2
++ 2 2 2 2 2
++ D - x2 - y2 = x3 - 2*x3*x2 + y3 - 2*y3*y2
+
+
+
+- 2 2 2 2 2
+- D - x2 - y2 = x3 - 2*x3*x2 + (m*x3 + b) - 2*(m*x3 + b)*y2
++ 2 2 2 2 2
++ D - x2 - y2 = x3 - 2*x3*x2 + (m*x3 + b) - 2*(m*x3 + b)*y2
+
+- 2 2 2 2 2 2
+- D - x2 - y2 + 2*b*y2 - b = (m + 1)*x3 + (-2*x2 + 2*m*b -2*m*y2)*x3
++ 2 2 2 2 2 2
++ D - x2 - y2 + 2*b*y2 - b = (m + 1)*x3 + (-2*x2 + 2*m*b -2*m*y2)*x3
+
+- 2 2 2 2
++ 2 2 2 2
+ C = - D + x2 + y2 - 2*b*y2 + b
+
+- 2
+- A = (m + 1)
++ 2
++ A = (m + 1)
+
+ B = (-2*x2 + 2*m*b -2*m*y2)
+
+@@ -1607,37 +1607,37 @@
+ A * x3 + B * x3 - C = 0
+
+
+- ---------------
+- -B + --- / 2
+- \/ B - 4*A*C
+- sol_1 = --------------------------------
+- 2*A
++ ---------------
++ --- / 2
++ -B + \/ B - 4*A*C
++ sol_1 = --------------------------------
++ 2*A
+
+
+- ---------------
+- sol_2 = -B - --- / 2
+- \/ B - 4*A*C
+- --------------------------------
+- 2*A
++ ---------------
++ --- / 2
++ -B - \/ B - 4*A*C
++ sol_2 = --------------------------------
++ 2*A
+
+ then in the distance formula we have only one variable x3 and that is easy
+ to calculate
+ */
+- int x1 = P1.y();
+- int y1 = P1.x();
+- int x2 = P2.y();
+- int y2 = P2.x();
++ if (P1.x() == P2.x()) {
++ return QPoint((int)(P2.x() + Distance), P2.y());
++ }
++ const int x1 = P1.y();
++ const int y1 = P1.x();
++ const int x2 = P2.y();
++ const int y2 = P2.x();
+
+- if(x2 == x1) {
+- return QPoint((int)(x2+ Distance), y2);
+- }
+ float slope = ((float)x1 - (float)x2) / ((float)y2 - (float)y1);
+ float b = (y2 - slope*x2);
+ float A = (slope * slope) + 1;
+- float B = (2*slope*b) - (2*x2) - (2*slope*y2);
++ float B = (2*slope*b) - (2*x2) - (2*slope*y2);
+ float C = (b*b) - (Distance*Distance) + (x2*x2) + (y2*y2) - (2*b*y2);
+ float t = B*B - 4*A*C;
+- if(t < 0) {
++ if (t < 0) {
+ return QPoint(-1, -1);
+ }
+ float sol_1 = ((-1* B) + sqrt(t) ) / (2*A);
+@@ -1799,63 +1799,66 @@
+
+ if (text) {
+ constrainTextPos(x, y, textW, textH, role);
+- if (x != p.x() || y != p.y()) {
+- // kdDebug() << "AssociationWidget::calculateTextPosition("
+- // << text->getName() << ") textrole " << role
+- // << ": oldpoint=(" << p.x() << "," << p.y() << ")"
+- // << ", newPoint=(" << x << "," << y << ")" << endl;
+- text->setX(x);
+- text->setY(y);
+- }
+ }
+ p = QPoint( x, y );
+ return p;
+ }
+
++QPoint AssociationWidget::midPoint(QPoint p0, QPoint p1) {
++ QPoint midP;
++ if (p0.x() < p1.x())
++ midP.setX(p0.x() + (p1.x() - p0.x()) / 2);
++ else
++ midP.setX(p1.x() + (p0.x() - p1.x()) / 2);
++ if (p0.y() < p1.y())
++ midP.setY(p0.y() + (p1.y() - p0.y()) / 2);
++ else
++ midP.setY(p1.y() + (p0.y() - p1.y()) / 2);
++ return midP;
++}
++
+ void AssociationWidget::constrainTextPos(int &textX, int &textY,
+ int textWidth, int textHeight,
+ Uml::Text_Role tr) {
+- const int CORRIDOR_HALFWIDTH = 30;
++ const int textCenterX = textX + textWidth / 2;
++ const int textCenterY = textY + textHeight / 2;
+ const uint lastSegment = m_LinePath.count() - 1;
+ QPoint p0, p1;
+- bool atSideA = false, atSideB = false;
+ switch (tr) {
+ case tr_RoleAName:
+ case tr_MultiA:
+ case tr_ChangeA:
+ p0 = m_LinePath.getPoint(0);
+ p1 = m_LinePath.getPoint(1);
+- atSideA = true;
++ // If we are dealing with a single line then tie the
++ // role label to the proper half of the line, i.e.
++ // the role label must be closer to the "other"
++ // role object.
++ if (lastSegment == 1)
++ p1 = midPoint(p0, p1);
+ break;
+ case tr_RoleBName:
+ case tr_MultiB:
+ case tr_ChangeB:
+ p0 = m_LinePath.getPoint(lastSegment - 1);
+ p1 = m_LinePath.getPoint(lastSegment);
+- atSideB = true;
++ if (lastSegment == 1)
++ p0 = midPoint(p0, p1);
+ break;
+ case tr_Name:
++ case tr_Coll_Message: // CHECK: collab.msg texts seem to be tr_Name
++ case tr_State: // CHECK: is this used?
+ // Find the linepath segment to which the (textX,textY) is closest
+ // and constrain to the corridor of that segment (see farther below)
+ {
+- const int textCenterX = textX + textWidth / 2;
+- const int textCenterY = textY + textHeight / 2;
+ int minDistSquare = 100000; // utopian initial value
+ int lpIndex = 0;
+ for (uint i = 0; i < lastSegment; i++) {
+ p0 = m_LinePath.getPoint(i);
+ p1 = m_LinePath.getPoint(i + 1);
+- QPoint midPoint;
+- if (p0.x() < p1.x())
+- midPoint.setX(p0.x() + (p1.x() - p0.x()) / 2);
+- else
+- midPoint.setX(p1.x() + (p0.x() - p1.x()) / 2);
+- if (p0.y() < p1.y())
+- midPoint.setY(p0.y() + (p1.y() - p0.y()) / 2);
+- else
+- midPoint.setY(p1.y() + (p0.y() - p1.y()) / 2);
+- const int deltaX = textCenterX - midPoint.x();
+- const int deltaY = textCenterY - midPoint.y();
++ QPoint midP = midPoint(p0, p1);
++ const int deltaX = textCenterX - midP.x();
++ const int deltaY = textCenterY - midP.y();
+ const int cSquare = deltaX * deltaX + deltaY * deltaY;
+ if (cSquare < minDistSquare) {
+ minDistSquare = cSquare;
+@@ -1872,85 +1875,85 @@
+ return;
+ break;
+ }
+- if (p0.x() >= p1.x() - 1 && p0.x() <= p1.x() + 1) {
+- // vertical line
+- // CAUTION: This is calculated in Qt coordinates!
+- ////////////////////////// constrain horizontally /////////////////////////
+- const int lineX = p0.x();
+- if (textX + textWidth < lineX - CORRIDOR_HALFWIDTH) // constrain at left
+- textX = lineX - CORRIDOR_HALFWIDTH - textWidth;
+- else if (textX > lineX + CORRIDOR_HALFWIDTH) // constrain at right
+- textX = lineX + CORRIDOR_HALFWIDTH;
+- ////////////////////////// constrain vertically ///////////////////////////
+- // pre-constrain the corridor to the appropriate half:
+- // This is only done for simple (i.e. non multi-segment) linepaths.
+- // With multi-segment linepaths, the user probably wants the freedom to
+- // place role related labels anywhere within the start and end segment.
+- if (lastSegment == 1) {
+- if (atSideA) {
+- if (p0.y() < p1.y())
+- p1.setY(p0.y() + (p1.y() - p0.y()) / 2);
+- else
+- p1.setY(p0.y() - (p0.y() - p1.y()) / 2);
+- } else if (atSideB) {
+- if (p0.y() > p1.y())
+- p0.setY(p1.y() + (p0.y() - p1.y()) / 2);
+- else
+- p0.setY(p1.y() - (p1.y() - p0.y()) / 2);
+- }
+- }
+- // swap points so that p0 contains the one with the smaller Y
+- if (p0.y() > p1.y()) {
+- QPoint tmp = p0;
+- p0 = p1;
+- p1 = tmp;
+- }
+- if (textY + textHeight < p0.y()) // constrain at top
+- textY = p0.y() - textHeight;
+- else if (textY > p1.y()) // constrain at bottom
+- textY = p1.y();
++ /* Constraint:
++ The midpoint between p0 and p1 is taken to be the center of a circle
++ with radius D/2 where D is the distance between p0 and p1.
++ The text center needs to be within this circle else it is constrained
++ to the nearest point on the circle.
++ */
++ p0 = swapXY(p0); // go to the natural coordinate system
++ p1 = swapXY(p1); // with (0,0) in the lower left corner
++ QPoint midP = midPoint(p0, p1);
++ // If (textX,textY) is not inside the circle around midP then
++ // constrain (textX,textY) to the nearest point on that circle.
++ const int x0 = p0.x();
++ const int y0 = p0.y();
++ const int x1 = p1.x();
++ const int y1 = p1.y();
++ double r = sqrt((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0)) / 2;
++ if (textWidth > r)
++ r = textWidth;
++ // swap textCenter{X,Y} to convert from Qt coord.system.
++ const QPoint origTextCenter(textCenterY, textCenterX);
++ const int relX = abs(origTextCenter.x() - midP.x());
++ const int relY = abs(origTextCenter.y() - midP.y());
++ const double negativeWhenInsideCircle = relX * relX + relY * relY - r * r;
++ if (negativeWhenInsideCircle <= 0.0) {
+ return;
+ }
+- if (p0.y() >= p1.y() - 1 && p0.y() <= p1.y() + 1) {
+- // horizontal line
+- // CAUTION: This is calculated in Qt coordinates!
+- ////////////////////////// constrain vertically /////////////////////////////
+- const int lineY = p0.y();
+- if (textY + textHeight < lineY - CORRIDOR_HALFWIDTH) // constrain at top
+- textY = lineY - CORRIDOR_HALFWIDTH - textHeight;
+- else if (textY > lineY + CORRIDOR_HALFWIDTH) // constrain at bottom
+- textY = lineY + CORRIDOR_HALFWIDTH;
+- ////////////////////////// constrain horizontally //////////////////////////
+- // pre-constrain the corridor to the appropriate half:
+- // This is only done for simple (i.e. non multi-segment) linepaths.
+- // With multi-segment linepaths, the user probably wants the freedom to
+- // place role related labels anywhere within the start and end segment.
+- if (lastSegment == 1) {
+- if (atSideA) {
+- if (p0.x() < p1.x())
+- p1.setX(p0.x() + (p1.x() - p0.x()) / 2);
+- else
+- p1.setX(p0.x() - (p0.x() - p1.x()) / 2);
+- } else if (atSideB) {
+- if (p0.x() < p1.x())
+- p0.setX(p1.x() - (p1.x() - p0.x()) / 2);
+- else
+- p0.setX(p1.x() + (p0.x() - p1.x()) / 2);
+- }
+- }
+- // swap points so that p0 contains the one with the smaller X
+- if (p0.x() > p1.x()) {
+- QPoint tmp = p0;
+- p0 = p1;
+- p1 = tmp;
+- }
+- if (textX + textWidth < p0.x()) // constrain at left
+- textX = p0.x() - textWidth;
+- else if (textX > p1.x()) // constrain at right
+- textX = p1.x();
++ /*
++ The original constraint was to snap the text position to the
++ midpoint but that creates unpleasant visual jitter:
++ textX = midP.y() - textWidth / 2; // go back to Qt coord.sys.
++ textY = midP.x() - textHeight / 2; // go back to Qt coord.sys.
++
++ Rather, we project the text position onto the closest point
++ on the circle:
++
++ Circle equation:
++ relX^2 + relY^2 - r^2 = 0 , or in other words
++ relY^2 = r^2 - relX^2 , or
++ relY = sqrt(r^2 - relX^2)
++ Line equation:
++ relY = a * relX + b
++ We can omit "b" because relX and relY are already relative to
++ the circle origin, therefore we can also write:
++ a = relY / relX
++ To obtain the point of intersection between the circle of radius r
++ and the line connecting the circle origin with the point (relX, relY),
++ we equate the relY:
++ a * x = sqrt(r^2 - x^2) , or in other words
++ a^2 * x^2 = r^2 - x^2 , or
++ x^2 * (a^2 + 1) = r^2 , or
++ x^2 = r^2 / (a^2 + 1) , or
++ x = sqrt(r^2 / (a^2 + 1))
++ and then
++ y = a * x
++ The resulting x and y are relative to the circle origin so we just add
++ the circle origin (X,Y) to obtain the constrained (textX,textY).
++ */
++ // Handle the special case, relX = 0.
++ if (relX == 0) {
++ if (origTextCenter.y() > midP.y())
++ textX = midP.y() + (int)r; // go back to Qt coord.sys.
++ else
++ textX = midP.y() - (int)r; // go back to Qt coord.sys.
++ textX -= textWidth / 2;
+ return;
+ }
+- // @todo deal with slopes
++ const double a = (double)relY / (double)relX;
++ const double x = sqrt(r*r / (a*a + 1));
++ const double y = a * x;
++ if (origTextCenter.x() > midP.x())
++ textY = midP.x() + (int)x; // go back to Qt coord.sys.
++ else
++ textY = midP.x() - (int)x; // go back to Qt coord.sys.
++ textY -= textHeight / 2;
++ if (origTextCenter.y() > midP.y())
++ textX = midP.y() + (int)y; // go back to Qt coord.sys.
++ else
++ textX = midP.y() - (int)y; // go back to Qt coord.sys.
++ textX -= textWidth / 2;
+ }
+
+ void AssociationWidget::calculateNameTextSegment() {
+--- umbrello/umbrello/classparser/cpptree2uml.cpp (revision 486002)
++++ umbrello/umbrello/classparser/cpptree2uml.cpp (revision 490305)
+@@ -406,7 +406,7 @@
+ QString text = typeSpec->text();
+ kdDebug() << "CppTree2Uml::parseElaboratedTypeSpecifier: text is " << text << endl;
+ text.remove(QRegExp("^class\\s+"));
+- UMLObject *o = Import_Utils::createUMLObject( Uml::ot_Class, text );
++ UMLObject *o = Import_Utils::createUMLObject(Uml::ot_Class, text, m_currentNamespace[m_nsCnt]);
+ flushTemplateParams( static_cast<UMLClassifier*>(o) );
+ }
+
+--- umbrello/umbrello/umlobject.h (revision 486002)
++++ umbrello/umbrello/umlobject.h (revision 490305)
+@@ -175,7 +175,7 @@
+ * Returns an empty string if no stereotype object is set.
+ *
+ * @param includeAdornments Include surrounding angled brackets
+- * "«" and "»".
++ * "«" and "»".
+ * @return Returns the classes stereotype name.
+ */
+ QString getStereotype(bool includeAdornments = false);
+--- umbrello/umbrello/import_utils.cpp (revision 486002)
++++ umbrello/umbrello/import_utils.cpp (revision 490305)
+@@ -200,7 +200,10 @@
+ o = origType;
+ }
+ } else if (parentPkg && !bPutAtGlobalScope) {
++ if (o->getUMLPackage())
++ o->getUMLPackage()->removeObject(o);
+ o->setUMLPackage(parentPkg);
++ parentPkg->addObject(o);
+ }
+ QString strippedComment = formatComment(comment);
+ if (! strippedComment.isEmpty()) {
+--- umbrello/umbrello/umlview.h (revision 486002)
++++ umbrello/umbrello/umlview.h (revision 490305)
+@@ -403,7 +403,14 @@
+ */
+ AssociationWidget * findAssocWidget(Uml::Association_Type at,
+ UMLWidget *pWidgetA, UMLWidget *pWidgetB);
++
++
+ /**
++ calls findAssocWidget on three possible types:
++ Uml::at_Aggregation << Uml::at_Composition << Uml::at_Containment
++ */
++ AssociationWidget * findAssocWidget(UMLWidget *pWidgetA, UMLWidget *pWidgetB);
++ /**
+ * Remove a widget from view.
+ *
+ * @param o The widget to remove.
+--- umbrello/umbrello/umlobject.cpp (revision 486002)
++++ umbrello/umbrello/umlobject.cpp (revision 490305)
+@@ -325,7 +325,7 @@
+ return "";
+ QString name = m_pStereotype->getName();
+ if (includeAdornments)
+- name = "«" + name + "»";
++ name = QString::fromUtf8("«") + name + QString::fromUtf8("»");
+ return name;
+ }
+
+--- umbrello/umbrello/entity.cpp (revision 486002)
++++ umbrello/umbrello/entity.cpp (revision 490305)
+@@ -167,7 +167,8 @@
+ }
+
+ int UMLEntity::entityAttributes() {
+- return m_List.count();
++ UMLClassifierListItemList entityAttributes = getFilteredList(Uml::ot_EntityAttribute);
++ return entityAttributes.count();
+ }
+
+
+--- umbrello/umbrello/entitywidget.cpp (revision 486002)
++++ umbrello/umbrello/entitywidget.cpp (revision 490305)
+@@ -104,8 +104,16 @@
+ for (entityattribute = list.first(); entityattribute; entityattribute = list.next()) {
+ QString text = entityattribute->getName();
+ p.setPen( QPen(Qt::black) );
++ UMLEntityAttribute* casted = dynamic_cast<UMLEntityAttribute*>( entityattribute );
++ if( casted && casted->getIndexType() == Uml::Primary )
++ {
++ font.setUnderline( true );
++ p.setFont( font );
++ font.setUnderline( false );
++ }
+ p.drawText(offsetX + ENTITY_MARGIN, offsetY + y,
+ fontMetrics.width(text), fontHeight, Qt::AlignVCenter, text);
++ p.setFont( font );
+ y+=fontHeight;
+ }
+
+--- umbrello/umbrello/associationwidget.h (revision 486002)
++++ umbrello/umbrello/associationwidget.h (revision 490305)
+@@ -724,6 +724,11 @@
+ static float perpendicularProjection(QPoint P1, QPoint P2, QPoint P3, QPoint& ResultingPoint);
+
+ /**
++ * Return the mid point between p0 and p1
++ */
++ static QPoint midPoint(QPoint p0, QPoint p1);
++
++ /**
+ * Calculates the position of the text widget depending on the role
+ * that widget is playing.
+ * Returns the point at which to put the widget.
+--- umbrello/umbrello/umlview.cpp (revision 486002)
++++ umbrello/umbrello/umlview.cpp (revision 490305)
+@@ -801,6 +801,8 @@
+ return 0;
+ }
+
++
++
+ AssociationWidget * UMLView::findAssocWidget( Uml::IDType id ) {
+ AssociationWidget *obj;
+ AssociationWidgetListIt it( m_AssociationList );
+@@ -814,6 +816,21 @@
+ return 0;
+ }
+
++AssociationWidget * UMLView::findAssocWidget(UMLWidget *pWidgetA, UMLWidget *pWidgetB) {
++ static QValueList<Association_Type> assocTypes;
++ if (assocTypes.isEmpty()) {
++ assocTypes << Uml::at_Aggregation
++ << Uml::at_Composition << Uml::at_Containment;
++ }
++ AssociationWidget* retval = NULL;
++ for (int i=0; i<assocTypes.size(); ++i) {
++ retval = findAssocWidget(assocTypes[i], pWidgetA, pWidgetB);
++ if (retval != NULL) return retval;
++ }
++ return retval;
++}
++
++
+ AssociationWidget * UMLView::findAssocWidget(Association_Type at,
+ UMLWidget *pWidgetA, UMLWidget *pWidgetB) {
+ AssociationWidget *assoc;
+@@ -2586,12 +2603,11 @@
+ UMLWidget *w = findWidget( attrType->getID() );
+ AssociationWidget *aw = NULL;
+ // if the attribute type has a widget representation on this view
+- if (w &&
+- // if the AssocWidget does not already exist then
+- ((aw = findAssocWidget(assocType, widget, w)) == NULL ||
+- aw->getRoleName(Uml::B) != attr->getName()) &&
+- // if the current diagram type permits compositions
+- AssocRules::allowAssociation(assocType, widget, w, false)) {
++ if (w) {
++ aw = findAssocWidget(widget, w) ;
++ if ( ( aw == NULL || aw->getRoleName(Uml::B) != attr->getName() ) &&
++ // if the current diagram type permits compositions
++ AssocRules::allowAssociation(assocType, widget, w, false) ) {
+ // Create a composition AssocWidget, or, if the attribute type is
+ // stereotyped <<CORBAInterface>>, create a UniAssociation widget.
+ if (attrType->getStereotype() == "CORBAInterface")
+@@ -2608,18 +2624,20 @@
+ a->setActivated(true);
+ if (! addAssociation(a))
+ delete a;
++ }
+ }
+ // if the attribute type is a UMLDatatype then
+ if (attrType->getBaseType() == ot_Datatype) {
+ UMLDatatype *dt = static_cast<UMLDatatype*>(attrType);
+ // if the UMLDatatype is a reference (pointer) type
+ if (dt->isReference()) {
++ Uml::Association_Type assocType = Uml::at_Composition;
+ UMLClassifier *c = dt->originType();
+ UMLWidget *w = c ? findWidget( c->getID() ) : 0;
+ // if the referenced type has a widget representation on this view
+- if (w &&
+- // if the AssocWidget does not already exist then
+- findAssocWidget(at_Aggregation, widget, w) == NULL &&
++ if (w) {
++ aw = findAssocWidget(widget, w);
++ if (aw == NULL &&
+ // if the current diagram type permits aggregations
+ AssocRules::allowAssociation(at_Aggregation, widget, w, false)) {
+ // create an aggregation AssocWidget from the ClassifierWidget
+@@ -2635,6 +2653,7 @@
+ a->setActivated(true);
+ if (! addAssociation(a))
+ delete a;
++ }
+ }
+ }
+ }
+--- umbrello/ChangeLog (revision 486002)
++++ umbrello/ChangeLog (revision 490305)
+@@ -1,3 +1,8 @@
++Version 1.5.1
++
++* Bugs fixed / wishes implemented (see http://bugs.kde.org)
++109963 117791 117875 117990 118570
++
+ Version 1.5
+
+ * Association classes
+--- umbrello/THANKS (revision 486002)
++++ umbrello/THANKS (revision 490305)
+@@ -52,6 +52,7 @@
+ Dimitri Ognibene <ognibened @yahoo.it>
+ Carsten Pfeiffer <pfeiffer @kde.org>
+ Ivan Porres <iporres @abo.fi>
++Maciej Puzio <maciek @work.swmed.edu>
+ Ruediger Ranft <kdebugs @rranft1.mail.htwm.de>
+ John Ratke <jratke @comcast.net>
+ Daniel Richard G. <skunk @iskunk.org>
+--- scripts/kdesvn-build (revision 486002)
++++ scripts/kdesvn-build (revision 490305)
+@@ -288,9 +288,9 @@
+ "build-dir" => "build",
+ "build-system-only" => "",
+ "checkout-only" => "",
+- "configure-flags" => "--enable-debug=full",
++ "configure-flags" => "--enable-debug",
+ "colorful-output" => 1, # Use color by default.
+- "cxxflags" => "-g -pipe",
++ "cxxflags" => "-pipe",
+ "debug" => "",
+ "debug-level" => INFO,
+ "dest-dir" => '${MODULE}', # single quotes used on purpose!
+--- scripts/fixfsfaddr.sed (revision 0)
++++ scripts/fixfsfaddr.sed (revision 490305)
+@@ -0,0 +1,28 @@
++#! /usr/bin/sed
++
++# Copyright 2005 Nicolas GOUTTE <goutte at kde.org>
++# License LGPL V2+
++
++# The script helps to fix the FSF address
++# Use:
++# find . -name .svn -prune , type f | xargs fgrep -l "Free Software Foundation" | xargs sed -i -f fixfsfaddr.sed
++# Note: you should check the changes before committing them.
++
++# Implementation note: we need to replace phrase by phrase, as
++# the wrapping of the FSF address is at different places.
++
++# Current FSF address: 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
++
++# Old address: 59 Temple Place, Suite 330, Boston, MA 02111-1307
++s/59 Temple Place,/51 Franklin Street,/
++s/59 Temple Place -/51 Franklin Street,/
++s/Suite 330,/Fifth Floor,/
++s/02111-1307/02110-1301/
++
++# Very old address: 675 Mass Ave, Cambridge, MA 02139
++s/675 Mass Ave/51 Franklin Street, Fifth Floor/
++s/Cambridge/Boston/
++s/02139/02110-1301/
++# Warning: the last two replaces seem to match the address of the MIT too.
++# Typo in KDE: Franklin Steet
++s/Franklin Steet/Franklin Street/
+--- scripts/kdesvn-buildrc-sample (revision 486002)
++++ scripts/kdesvn-buildrc-sample (revision 490305)
+@@ -31,13 +31,13 @@
+
+ # This controls the configure flags passed to every module (except qt-copy) by
+ # default. If you have module-specific configure flags, they will be placed
+-# after these flags to allow the module setting to override them.
+- configure-flags --enable-debug=full
++# after these flags to allow the module setting to override the global setting.
++ configure-flags --enable-debug
+
+ # These are the compilation flags to use by default when compiling KDE.
+-# The -march option also supports pentium4, athlon-xp, etc. See the gcc man
+-# page for more information.
+- cxxflags -g -pipe -march=i686
++# gcc supports a -march option in order to generate specific code for pentium4, athlon-xp,
++# etc. See the gcc man page for more information.
++ cxxflags -pipe
+
+ # These are the default options passed to the make command. The default tries
+ # to build with 2 parallel compiles. If you are using distcc or have SMP, you
+--- scripts/kde-emacs/kde-emacs-vars.el (revision 486002)
++++ scripts/kde-emacs/kde-emacs-vars.el (revision 490305)
+@@ -15,8 +15,8 @@
+ ;; ;;
+ ;; 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. ;;
++;; Foundation, Inc., 51 Franklin Steet, Fifth Floor, Boston, MA ;;
++;; 02110-1301, USA. ;;
+ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+ (defconst kde-emacs-version "0.2"
+--- scripts/kde-emacs/kde-emacs-bindings.el (revision 486002)
++++ scripts/kde-emacs/kde-emacs-bindings.el (revision 490305)
+@@ -14,8 +14,8 @@
+ ;;
+ ;; You should have received a copy of the GNU Lesser General Public
+ ;; License along with this library; if not, write to the Free Software
+-;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+-;; 02111-1307 USA
++;; Foundation, Inc., 51 Franklin Steet, Fifth Floor, Boston, MA
++;; 02110-1301 USA
+
+ ; currently no binding for header-protection and add-file-to-makefile-am,
+ ; you need to call them from M-x
+--- scripts/kde-emacs/kde-emacs-general.el (revision 486002)
++++ scripts/kde-emacs/kde-emacs-general.el (revision 490305)
+@@ -14,8 +14,8 @@
+ ;;
+ ;; You should have received a copy of the GNU Lesser General Public
+ ;; License along with this library; if not, write to the Free Software
+-;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+-;; 02111-1307 USA
++;; Foundation, Inc., 51 Franklin Steet, Fifth Floor, Boston, MA
++;; 02110-1301 USA
+
+ ;;; Commentary:
+ ;;
+--- scripts/kde-emacs/kde-emacs-utils.el (revision 486002)
++++ scripts/kde-emacs/kde-emacs-utils.el (revision 490305)
+@@ -14,8 +14,8 @@
+ ;;
+ ;; You should have received a copy of the GNU Lesser General Public
+ ;; License along with this library; if not, write to the Free Software
+-;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+-;; 02111-1307 USA
++;; Foundation, Inc., 51 Franklin Steet, Fifth Floor, Boston, MA
++;; 02110-1301 USA
+
+
+ (require 'kde-emacs-vars)
+@@ -80,7 +80,7 @@
+ (let ((pos (c-safe-scan-lists (point) -1 1)))
+ ; +1 added here so that the regexp in the while matches the { too.
+ (goto-char (if pos (+ pos 1) (point-min))))
+- (while (re-search-backward "^[ ]*\\(class\\|namespace\\)[ \t][^};]*{" nil t)
++ (while (re-search-backward "^[ ]*\\(class\\|namespace\\|struct\\)[ \t][^};]*{" nil t)
+ (save-excursion
+ (forward-word 1)
+ (when (looking-at "[ \t]*[A-Z_]*_EXPORT[A-Z_]*[ \t]")
+@@ -136,6 +136,8 @@
+ (setq function (replace-match " " t t function)))
+ (and (string-match "^\\(virtual\\>\\)?[ \t]*" function)
+ (setq function (replace-match "" t t function)))
++ (and (string-match "^\\(explicit\\>\\)?[ \t]*" function)
++ (setq function (replace-match "" t t function)))
+ (and (string-match "^\\(static\\>\\)?[ \t]*" function)
+ (setq function (replace-match "" t t function)))
+ (while (string-match " +" function) ; simplifyWhiteSpace
+@@ -218,11 +220,15 @@
+ (setq function (match-string 2 a))
+ (kde-switch-cpp-h)
+ (goto-char 0)
++ ; Look for beginning of class ("\\s-+" means whitespace including newlines)
+ (re-search-forward
+ (concat "\\(class\\|struct\\|namespace\\)\\s-+"
+- class "[^;]+{") nil t)
++ "\\([A-Z_]+_EXPORT[A-Z_]*\\)?\\s-+" ; allow for optional EXPORT macro
++ class "\\b" ; the classname - with word separator
++ "[^;]+{" ; the optional inheritance and the '{'
++ ) nil t)
+ ;; TODO keep looking, until we find a match that's not inside a comment
+- (re-search-forward (concat "[ \t]+" (regexp-quote function) "[ \t]*(") nil t)))))
++ (re-search-forward (concat "\\b" (kde-function-regexp-quote function) "[ \t]*(") nil t)))))
+ (if (string-match "\\.h$" n)
+ (progn
+ (let ((mup (method-under-point))
+@@ -238,7 +244,7 @@
+ (setq sig (kde-remove-newline (kde-function-impl-sig namespace class function)))
+ (if (string-match "(.*" sig) ; remove args
+ (setq sig (replace-match "" nil t sig)))
+- (setq found (re-search-forward (concat "^[^()]*" (regexp-quote sig) "[ \t]*(") nil t) )
++ (setq found (re-search-forward (concat "^[^()]*" (kde-function-regexp-quote sig) "[ \t]*(") nil t) )
+
+ (if (not found)
+ (progn
+@@ -249,14 +255,14 @@
+
+ (if (string-match "(.*" sig) ; remove args
+ (setq sig (replace-match "" nil t sig)))
+- (re-search-forward (concat "^[^()]*" (regexp-quote sig) "[ \t]*(") nil t) ) )
++ (re-search-forward (concat "^[^()]*" (kde-function-regexp-quote sig) "[ \t]*(") nil t) ) )
+ )))))
+
+ (defun kde-remove-newline (str)
+- (let ((res str))
+- (while (string-match "\n" res )
+- (setq res (replace-match " " nil t res)))
+- res))
++ (replace-in-string str "\n" " "))
++; quote for use as regexp, but replace spaces with "any whitespace"
++(defun kde-function-regexp-quote (str)
++ (replace-in-string (regexp-quote str) "[ \n\t]" "[ \n\t]"))
+
+ ; Initial implementation by Arnt Gulbransen
+ ; Current maintainer: David Faure
+@@ -272,6 +278,7 @@
+ (insertion-string (kde-function-impl-sig namespace class function))
+ (msubstr nil)
+ (start nil)
++ (newcppfile nil)
+ )
+ (setq insertion-string
+ (concat insertion-string "\n{\n"
+@@ -283,12 +290,25 @@
+ ; move to next method, to be ready for next call
+ (backward-char) ; in case we're after the ';'
+ (re-search-forward ";" nil t) ; end of this method decl
+- (re-search-forward ";" nil t) ; end of next method decl
++ (let ((moveToNext t))
++ (while moveToNext
++ (re-search-forward ";" nil t) ; end of next method decl
++ (save-excursion
++ (forward-char -2) ; -1 goes to ';' itself, so go before that
++ (while (looking-at "[ \t0=]")
++ (forward-char -1))
++ (forward-char 1)
++ ; move to next method again if we're at a pure virtual method
++ (setq moveToNext (looking-at "[ \t]*=[ \t]*0;"))
++ )
++ )
++ )
+
++ (setq newcppfile (not (cdr (kde-file-get-cpp-h))))
+ (if (string-match "\\.h$" file)
+ (kde-switch-cpp-h)
+ )
+- (goto-char (point-max))
++ (goto-char (point-max))
+ (kde-comments-begin)
+ (kde-skip-blank-lines)
+ (setq msubstr (buffer-substring (point-at-bol) (point-at-eol)))
+@@ -303,6 +323,8 @@
+ (insert "\n")
+ (forward-line 1)
+ ))
++ (when newcppfile
++ (insert "\n"))
+ (insert insertion-string)
+ (forward-char -3)
+ (c-indent-defun)
+@@ -316,20 +338,31 @@
+ (fume-rescan-buffer))
+ ))
+
++(defun add-file-to-buildsystem ()
++ "Add the current (C++) file to either Makefile.am or a .pro file, whichever exists."
++ ; Author: David
++ (interactive)
++ (if (file-readable-p "Makefile.am")
++ (add-file-to-makefile-am)
++ ; else: find a .pro file and add it there
++ (let* ((files (directory-files "." nil ".pro$" nil t))
++ (projfile (car files)))
++ (if projfile
++ (add-file-to-project projfile "^SOURCES[ \t]*") ; could be SOURCES= or SOURCES+=
++ ; else: error
++ (error "No build system file found")
++ )))
++ )
+
+-; Adds the current file to Makefile.am.
+-; Written by David.
+-(defun add-file-to-makefile-am ()
+- "add the current file to the _SOURCES tag in the Makefile.am"
+- (interactive)
+- (let ((file (buffer-name))
+- (makefile "Makefile.am"))
++; internal helper for add-file-to-*
++(defun add-file-to-project (makefile searchString)
++ (let ((file (buffer-name)))
+ (if (not (file-readable-p makefile))
+- (error "Makefile.am not found!")
++ (error (concat makefile " not found!"))
+ )
+ (find-file makefile)
+ (goto-char (point-min))
+- (if (re-search-forward "_SOURCES" nil t)
++ (if (re-search-forward searchString nil t)
+ (progn
+ (end-of-line)
+ ; check if line ends with '\' [had to read make-mode.el to find this one!]
+@@ -338,12 +371,18 @@
+ (insert " ")
+ (insert file)
+ )
+- (error "_SOURCES not found")
+- )
+- )
++ (error (concat searchString " not found"))
++ ))
+ )
+
++(defun add-file-to-makefile-am ()
++ "Add the current file to the first _SOURCES line in the Makefile.am"
++ ; Author: David
++ (interactive)
++ (add-file-to-project "Makefile.am" "_SOURCES")
++ )
+
++
+ ; Inserts a kdDebug statement showing the name of the current method.
+ ; You need to create the empty line first.
+ (defun insert-kdDebug ()
+@@ -826,16 +865,29 @@
+ (defun qt-open-header ()
+ "Open the Qt header file for the class under point"
+ (interactive)
+- (let* ((file (getenv "QTDIR"))
++ (let* ((qtinc (concat (getenv "QTDIR") "/include/"))
+ (class (thing-at-point 'word))
+ (f nil)
+- (files (directory-files (concat file "/include") t nil "dirsonly"))
++ (file nil)
++ (files nil)
+ )
+ (save-excursion
+- (dolist (f files nil)
+- (if (file-readable-p (concat f "/" class) )
+- (setq file (concat f "/" class))))
+- (qt-follow-includes file)
++ ; The Qt3 case: the includes are directly in $QTDIR/include/, lowercased
++ (setq f (concat qtinc (downcase class) ".h" ))
++ (if (file-readable-p f)
++ (setq file f)
++ ; For some Qt3/e classes: add _qws
++ (setq f (concat qtinc (downcase class) "_qws.h" ))
++ (if (file-readable-p f)
++ (setq file f)
++ ; The Qt4 case: the includes are in $QTDIR/include/QSomething/, in original case
++ (setq files (directory-files qtinc t nil "dirsonly"))
++ (dolist (f files nil)
++ (if (file-readable-p (concat f "/" class) )
++ (setq file (concat f "/" class))))
++ ))
++ (and file
++ (qt-follow-includes file))
+ )
+ ))
+
+--- scripts/kde-emacs/kde-emacs.el (revision 486002)
++++ scripts/kde-emacs/kde-emacs.el (revision 490305)
+@@ -15,8 +15,8 @@
+ ;;
+ ;; You should have received a copy of the GNU Lesser General Public
+ ;; License along with this library; if not, write to the Free Software
+-;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+-;; 02111-1307 USA
++;; Foundation, Inc., 51 Franklin Steet, Fifth Floor, Boston, MA
++;; 02110-1301 USA
+
+ ;;; Installation:
+ ;;
+--- scripts/kde-emacs/dirvars.el (revision 486002)
++++ scripts/kde-emacs/dirvars.el (revision 490305)
+@@ -21,8 +21,8 @@
+
+ ;; You should have received a copy of the GNU General Public License
+ ;; along with GNU Emacs; see the file COPYING. If not, write to
+-;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+-;; Boston, MA 02111-1307, USA.
++;; the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
++;; Boston, MA 02110-1301, USA.
+
+ ;;; Commentary:
+
+--- scripts/kde-emacs/kde-emacs-compat.el (revision 486002)
++++ scripts/kde-emacs/kde-emacs-compat.el (revision 490305)
+@@ -16,8 +16,8 @@
+ ;;
+ ;; 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.
++;; Foundation, Inc., 51 Franklin Steet, Fifth Floor, Boston, MA
++;; 02110-1301, USA.
+
+ (require 'kde-emacs-vars)
+
+--- scripts/kde-emacs/kde-emacs-semantic.el (revision 486002)
++++ scripts/kde-emacs/kde-emacs-semantic.el (revision 490305)
+@@ -14,8 +14,8 @@
+ ;;
+ ;; You should have received a copy of the GNU Lesser General Public
+ ;; License along with this library; if not, write to the Free Software
+-;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+-;; 02111-1307 USA
++;; Foundation, Inc., 51 Franklin Steet, Fifth Floor, Boston, MA
++;; 02110-1301 USA
+
+ ;;; Commentary:
+ ;; Package provides four interactive functions:
+--- scripts/kde-emacs/kde-emacs-doc.el (revision 486002)
++++ scripts/kde-emacs/kde-emacs-doc.el (revision 490305)
+@@ -14,8 +14,8 @@
+ ;;
+ ;; You should have received a copy of the GNU Lesser General Public
+ ;; License along with this library; if not, write to the Free Software
+-;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+-;; 02111-1307 USA
++;; Foundation, Inc., 51 Franklin Steet, Fifth Floor, Boston, MA
++;; 02110-1301 USA
+ ;;
+ ;;
+ ;;; Documentation :
+@@ -54,8 +54,8 @@
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+-02111-1307 USA"
++Foundation, Inc., 51 Franklin Steet, Fifth Floor, Boston, MA
++02110-1301 USA"
+ "GNU LGPL license header.")
+
+ (defvar GPL "This program is free software; you can redistribute it and/or
+@@ -70,8 +70,8 @@
+
+ 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."
++Foundation, Inc., 51 Franklin Steet, Fifth Floor, Boston, MA
++02110-1301, USA."
+ "GNU GPL license header.")
+
+ (defvar FDL "Permission is granted to copy, distribute and/or modify this document
+--- scripts/kde-emacs/kde-emacs-core.el (revision 486002)
++++ scripts/kde-emacs/kde-emacs-core.el (revision 490305)
+@@ -14,8 +14,8 @@
+ ;;
+ ;; You should have received a copy of the GNU Lesser General Public
+ ;; License along with this library; if not, write to the Free Software
+-;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+-;; 02111-1307 USA
++;; Foundation, Inc., 51 Franklin Steet, Fifth Floor, Boston, MA
++;; 02110-1301 USA
+
+ (require 'kde-emacs-vars)
+ ;*---------------------------------------------------------------------*/
+--- kbugbuster/gui/cwbugdetails.cpp (revision 486002)
++++ kbugbuster/gui/cwbugdetails.cpp (revision 490305)
+@@ -122,10 +122,12 @@
+ text.append( "<a href=\"" + BugSystem::self()->server()->bugLink( bug ).url()
+ + "\">" + i18n("Bug Report</a> from <b>%1</b>")
+ .arg( sender ) );
+- else
++ else {
+ text.append( "<a href=\"" + BugSystem::self()->server()->bugLink( bug ).url() + QString("#c%1").arg( replies )
+ + "\">" + i18n("Reply #%1</a> from <b>%2</b>")
+- .arg( replies-- ).arg( sender ) );
++ .arg( replies ).arg( sender ) );
++ replies--;
++ }
+ text.append( "</div>\n" );
+ text += "<div style=\"" + highlightStyle + borderBottomStyle;
+ if ( !firstHeader ) text += borderTopStyle;
More information about the pkg-kde-commits
mailing list