[Uml-devel] KDE/kdesdk/umbrello/umbrello/clipboard

Andi Fischer andi.fischer at hispeed.ch
Tue Mar 10 21:54:04 UTC 2009


SVN commit 937969 by fischer:

Some comments fixed.

 M  +71 -41    umlclipboard.cpp  
 M  +9 -9      umlclipboard.h  


--- trunk/KDE/kdesdk/umbrello/umbrello/clipboard/umlclipboard.cpp #937968:937969
@@ -57,7 +57,9 @@
 }
 
 /**
- * ...
+ * Copy operation.
+ * @param fromView   flag if it is from view
+ * @return           the mime data
  */
 QMimeData* UMLClipboard::copy(bool fromView/*=false*/)
 {
@@ -154,7 +156,7 @@
 /**
  * Inserts the clipboard's contents.
  *
- * @param Data   Pointer to the MIME format clipboard data.
+ * @param data   Pointer to the MIME format clipboard data.
  * @return       True for successful operation.
  */
 bool UMLClipboard::paste(const QMimeData* data)
@@ -188,19 +190,20 @@
 /**
  * Fills the member lists with all the objects and other
  * stuff to be copied to the clipboard.
+ * @param selectedItems   list of selected items
  */
-bool UMLClipboard::fillSelectionLists(UMLListViewItemList& SelectedItems)
+bool UMLClipboard::fillSelectionLists(UMLListViewItemList& selectedItems)
 {
     Uml::ListView_Type type;
     switch(m_type) {
     case clip4:
         break;
     case clip3:
-        foreach ( UMLListViewItem* item , SelectedItems ) {
+        foreach ( UMLListViewItem* item , selectedItems ) {
             type = item->getType();
             if ( !Model_Utils::typeIsClassifierList(type) ) {
                 m_ItemList.append(item);
-                insertItemChildren(item, SelectedItems);
+                insertItemChildren(item, selectedItems);
                 //Because it is being called when m_type is 3
                 //it will insert only child empty folders of other folders.
                 //If a child folder
@@ -212,7 +215,7 @@
         break;
     case clip2:
     case clip1:
-        foreach ( UMLListViewItem* item , SelectedItems ) {
+        foreach ( UMLListViewItem* item , selectedItems ) {
             type = item->getType();
             if ( !Model_Utils::typeIsClassifierList(type) ) {
 
@@ -221,12 +224,12 @@
                 if ( Model_Utils::typeIsCanvasWidget(type) ) {
                     m_ObjectList.append(item->getUMLObject());
                 }
-                insertItemChildren(item, SelectedItems);
+                insertItemChildren(item, selectedItems);
             }
         }
         break;
     case clip5:
-        foreach ( UMLListViewItem* item , SelectedItems ) {
+        foreach ( UMLListViewItem* item , selectedItems ) {
             type = item->getType();
             if( Model_Utils::typeIsClassifierList(type) ) {
                 m_ItemList.append(item);
@@ -244,16 +247,17 @@
 
 /**
  * Checks the whole list to determine the copy action
- * type to be * performed, sets the type in the m_type
+ * type to be performed, sets the type in the m_type
  * member variable.
+ * @param selectedItems   list of selected items
  */
-void UMLClipboard::setCopyType(UMLListViewItemList& SelectedItems)
+void UMLClipboard::setCopyType(UMLListViewItemList& selectedItems)
 {
     bool withDiagrams = false; //If the selection includes diagrams
     bool withObjects = false; //If the selection includes objects
     bool onlyAttsOps = false; //If the selection only includes Attributes and/or Operations
 
-    foreach ( UMLListViewItem* item, SelectedItems ) {
+    foreach ( UMLListViewItem* item, selectedItems ) {
         checkItemForCopyType(item, withDiagrams, withObjects, onlyAttsOps);
     }
     if(onlyAttsOps) {
@@ -270,32 +274,36 @@
 /**
  * Searches the child items of a UMLListViewItem to
  * establish which Copy type is to be perfomed.
+ * @param item          parent of the children
+ * @param withDiagrams  includes diagrams
+ * @param withObjects   includes objects
+ * @param onlyAttsOps   includes only attributes and/or operations
  */
-void UMLClipboard::checkItemForCopyType(UMLListViewItem* Item, bool & WithDiagrams, bool &WithObjects,
-                                        bool &OnlyAttsOps)
+void UMLClipboard::checkItemForCopyType(UMLListViewItem* item, bool & withDiagrams, bool & withObjects,
+                                        bool & onlyAttsOps)
 {
-    if(!Item) {
+    if(!item) {
         return;
     }
     UMLDoc *doc = UMLApp::app()->getDocument();
-    OnlyAttsOps = true;
+    onlyAttsOps = true;
     UMLView * view = 0;
     UMLListViewItem * child = 0;
-    Uml::ListView_Type type = Item->getType();
+    Uml::ListView_Type type = item->getType();
     if ( Model_Utils::typeIsCanvasWidget(type) ) {
-        WithObjects = true;
-        OnlyAttsOps = false;
+        withObjects = true;
+        onlyAttsOps = false;
     } else if ( Model_Utils::typeIsDiagram(type) ) {
-        WithDiagrams = true;
-        OnlyAttsOps = false;
-        view = doc->findView( Item->getID() );
+        withDiagrams = true;
+        onlyAttsOps = false;
+        view = doc->findView( item->getID() );
         m_ViewList.append( view );
     } else if ( Model_Utils::typeIsFolder(type) ) {
-        OnlyAttsOps = false;
-        if(Item->childCount()) {
-            child = (UMLListViewItem*)Item->firstChild();
+        onlyAttsOps = false;
+        if(item->childCount()) {
+            child = (UMLListViewItem*)item->firstChild();
             while(child) {
-                checkItemForCopyType(child, WithDiagrams, WithObjects, OnlyAttsOps);
+                checkItemForCopyType(child, withDiagrams, withObjects, onlyAttsOps);
                 child = (UMLListViewItem*)child->nextSibling();
             }
         }
@@ -304,11 +312,14 @@
 
 /**
  * Adds the children of a UMLListViewItem to m_ItemList.
+ * @param item            parent of the children to insert
+ * @param selectedItems   list of selected items
+ * @return                success flag
  */
-bool UMLClipboard::insertItemChildren(UMLListViewItem * Item, UMLListViewItemList& SelectedItems)
+bool UMLClipboard::insertItemChildren(UMLListViewItem * item, UMLListViewItemList& selectedItems)
 {
-    if(Item->childCount()) {
-        UMLListViewItem * child = (UMLListViewItem*)Item->firstChild();
+    if(item->childCount()) {
+        UMLListViewItem * child = (UMLListViewItem*)item->firstChild();
         int type;
         while(child) {
             m_ItemList.append(child);
@@ -319,9 +330,9 @@
             // If the child is selected, remove it from the list of selected items
             // otherwise it will be inserted twice in m_ObjectList.
             if(child->isSelected()) {
-                SelectedItems.removeAll(child);
+                selectedItems.removeAll(child);
             }
-            insertItemChildren(child, SelectedItems);
+            insertItemChildren(child, selectedItems);
             child = (UMLListViewItem*)child->nextSibling();
         }
     }
@@ -330,6 +341,9 @@
 
 /**
  * Pastes the children of a UMLListViewItem (The Parent)
+ * @param parent   parent of the children
+ * @param chgLog   ID change log
+ * @return         success flag
  */
 bool UMLClipboard::pasteChildren(UMLListViewItem *parent, IDChangeLog *chgLog)
 {
@@ -367,6 +381,7 @@
 /**
  * Cleans the list of associations taking out the ones that point to an object
  * not in m_ObjectList.
+ * @param associations   list of associations
  */
 void UMLClipboard::CleanAssociations(AssociationWidgetList& associations)
 {
@@ -381,6 +396,7 @@
 /**
  * If clipboard has mime type application/x-uml-clip1,
  * Pastes the data from the clipboard into the current Doc.
+ * @param data   mime type
  */
 bool UMLClipboard::pasteClip1(const QMimeData* data)
 {
@@ -411,14 +427,16 @@
 /**
  * If clipboard has mime type application/x-uml-clip2,
  * Pastes the data from the clipboard into the current Doc.
+ * @param data   mime type
+ * @return       success flag
  */
 bool UMLClipboard::pasteClip2(const QMimeData* data)
 {
-    UMLDoc *doc = UMLApp::app()->getDocument();
+    UMLDoc*             doc = UMLApp::app()->getDocument();
     UMLListViewItemList itemdatalist;
-    UMLObjectList objects;
+    UMLObjectList       objects;
     UMLViewList         views;
-    IDChangeLog* idchanges = 0;
+    IDChangeLog*        idchanges = 0;
 
     bool result = UMLDragData::decodeClip2(data, objects, itemdatalist, views);
     if(!result) {
@@ -431,7 +449,7 @@
     }
     foreach ( UMLObject* obj, objects ) {
         if(!doc->assignNewIDs(obj)) {
-            uDebug()<<"UMLClipboard: error adding umlobject";
+            uDebug() << "UMLClipboard: error adding umlobject";
             return false;
         }
     }
@@ -462,6 +480,8 @@
 /**
  * If clipboard has mime type application/x-uml-clip3,
  * Pastes the data from the clipboard into the current Doc.
+ * @param data   mime type
+ * @return       success flag
  */
 bool UMLClipboard::pasteClip3(const QMimeData* data)
 {
@@ -494,6 +514,8 @@
 /**
  * If clipboard has mime type application/x-uml-clip4,
  * Pastes the data from the clipboard into the current Doc.
+ * @param data   mime type
+ * @return       success flag
  */
 bool UMLClipboard::pasteClip4(const QMimeData* data)
 {
@@ -593,6 +615,8 @@
 /**
  * If clipboard has mime type application/x-uml-clip5,
  * Pastes the data from the clipboard into the current Doc.
+ * @param data   mime type
+ * @return       success flag
  */
 bool UMLClipboard::pasteClip5(const QMimeData* data)
 {
@@ -638,7 +662,8 @@
                 if (parent->addAttribute(att, idchanges)) {
                     result = true;
                 } else {
-                    uError() << "" << parent->getName() << "->addAttribute(" << att->getName() << ") failed";
+                    uError() << "" << parent->getName() << "->addAttribute("
+                             << att->getName() << ") failed";
                 }
                 break;
             }
@@ -653,7 +678,8 @@
                 if (parent->addOperation(op, idchanges)) {
                     result = true;
                 } else {
-                    uError() << "" << parent->getName() << "->addOperation(" << op->getName() << ") failed";
+                    uError() << "" << parent->getName() << "->addOperation("
+                             << op->getName() << ") failed";
                 }
                 break;
             }
@@ -668,7 +694,8 @@
                 if ( parent->addTemplate( tp, idchanges ) ) {
                     result = true;
                 } else {
-                    uError()<<""<<parent->getName()<<"->addTemplate("<<tp->getName()<<") failed";
+                    uError() << "" << parent->getName() << "->addTemplate("
+                             << tp->getName() << ") failed";
                 }
                 break;
             }
@@ -692,7 +719,8 @@
                if ( enumParent->addEnumLiteral( enl, idchanges ) ) {
                    result = true;
                } else {
-                   uError()<<""<<enumParent->getName()<<"->addEnumLiteral("<<enl->getName()<<") failed";
+                   uError() << "" << enumParent->getName() << "->addEnumLiteral("
+                            << enl->getName() << ") failed";
                }
                break;
            }
@@ -702,7 +730,7 @@
                 // if parent is not a UMLEntity, bail out immediately;
                 if ( !entityParent ) {
                     result = false;
-                    uError()<<"Parent is not an UMLEntity";
+                    uError() << "Parent is not an UMLEntity";
                     break;
                 }
                 UMLObject *exist = entityParent->findChildObject(obj->getName(), Uml::ot_EntityAttribute);
@@ -733,11 +761,13 @@
  * into the item data list.  Used for clip type 4.  Used
  * to make * sure classes have all the attributes and
  * operations saved.
+ * @param item   parent item, its children are inserted
+ * @return       success flag
  */
 bool UMLClipboard::insertItemChildren( UMLListViewItem * item )
 {
-    if( item -> childCount() ) {
-        UMLListViewItem * child =dynamic_cast<UMLListViewItem *>( item -> firstChild() );
+    if( item->childCount() ) {
+        UMLListViewItem * child =dynamic_cast<UMLListViewItem *>( item->firstChild() );
         while( child ) {
             m_ItemList.append( child );
             insertItemChildren( child );
--- trunk/KDE/kdesdk/umbrello/umbrello/clipboard/umlclipboard.h #937968:937969
@@ -39,7 +39,7 @@
 
     virtual ~UMLClipboard();
 
-    bool paste(const QMimeData* Data);
+    bool paste(const QMimeData* data);
 
     QMimeData* copy(bool fromView = false);
 
@@ -74,17 +74,17 @@
 
 private:
 
-    bool fillSelectionLists(UMLListViewItemList& SelectedItems);
+    bool fillSelectionLists(UMLListViewItemList& selectedItems);
 
-    void setCopyType(UMLListViewItemList& SelectedItems);
+    void setCopyType(UMLListViewItemList& selectedItems);
 
-    void checkItemForCopyType(UMLListViewItem* Item,
-                              bool& WithDiagrams,
-                              bool& WithObjects,
-                              bool& OnlyAttsOps);
+    void checkItemForCopyType(UMLListViewItem* item,
+                              bool& withDiagrams,
+                              bool& withObjects,
+                              bool& onlyAttsOps);
 
-    bool insertItemChildren(UMLListViewItem* Item,
-                            UMLListViewItemList& SelectedItems);
+    bool insertItemChildren(UMLListViewItem* item,
+                            UMLListViewItemList& selectedItems);
 
     bool insertItemChildren(UMLListViewItem* item);
 




More information about the umbrello-devel mailing list