]> Git trees. - libqmvoc.git/commitdiff
Remove sort functions from the document. v3.90.1
authorPeter Hedlund <peter@peterandlinda.com>
Tue, 1 May 2007 21:40:39 +0000 (21:40 +0000)
committerPeter Hedlund <peter@peterandlinda.com>
Tue, 1 May 2007 21:40:39 +0000 (21:40 +0000)
svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=660188

kdeeducore/keduvocdocument.cpp
kdeeducore/keduvocdocument.h

index 4de1e6d6129ff6a1b5d363cf0cc6f24ae5c46c93..f778ccbb120f24292186b0525e8e05d1bfa6177b 100644 (file)
@@ -119,36 +119,6 @@ void KEduVocDocument::Private::init()
 }
 
 
-/**@todo possibly implement
-  1. sorting based on lesson name
-  2. sorting based on lesson index and original.
-*/
-
-class KEduVocDocumentSortHelper
-{
-public:
-  inline KEduVocDocumentSortHelper(int column, Qt::SortOrder order) : sort_column(column), sort_order(order) {}
-
-  inline bool operator()(const KEduVocExpression &e1, const KEduVocExpression &e2) const
-    {
-    if (sort_order == Qt::AscendingOrder)
-      if (sort_column == 0)
-        return e1.original().toLower() < e2.original().toLower();
-      else
-        return e1.translation(sort_column).toLower() < e2.translation(sort_column).toLower();
-    else
-      if (sort_column == 0)
-        return !(e1.original().toLower() < e2.original().toLower());
-      else
-        return !(e1.translation(sort_column).toLower() < e2.translation(sort_column).toLower());
-    }
-
-private:
-  int sort_column;
-  Qt::SortOrder sort_order;
-};
-
-
 KEduVocDocument::KEduVocDocument(QObject *parent)
   : QObject(parent), d(new Private(this))
 {
@@ -880,53 +850,6 @@ void KEduVocDocument::setOriginalIdentifier(const QString &id)
 }
 
 
-bool KEduVocDocument::sort(int index, Qt::SortOrder order)
-{
-  bool result = false;
-  if (d->m_sortingEnabled && index < identifierCount())
-  {
-    if (d->m_sortIdentifier.count() < d->m_identifiers.count())
-      for (int i = d->m_sortIdentifier.count(); i < d->m_identifiers.count(); i++)
-          d->m_sortIdentifier.append(false);
-
-    d->m_sortIdentifier[index] = (order == Qt::AscendingOrder);
-    result = sort(index);
-  }
-  return result;
-}
-
-bool KEduVocDocument::sort(int index)
-{
-  bool result = false;
-  if (d->m_sortingEnabled && index < identifierCount())
-  {
-    if (d->m_sortIdentifier.count() < d->m_identifiers.count())
-      for (int i = d->m_sortIdentifier.count(); i < d->m_identifiers.count(); i++)
-          d->m_sortIdentifier.append(false);
-
-    KEduVocDocumentSortHelper sh(index, d->m_sortIdentifier[index] ? Qt::AscendingOrder : Qt::DescendingOrder);
-    qSort(d->m_vocabulary.begin(), d->m_vocabulary.end(), sh);
-    d->m_sortIdentifier[index] = !d->m_sortIdentifier[index];
-    result = d->m_sortIdentifier[index];
-  }
-  return result;
-}
-
-
-bool KEduVocDocument::sortByLessonAlpha ()
-{
-  ///@todo remove?
-  return false;
-}
-
-
-bool KEduVocDocument::sortByLessonIndex ()
-{
-  ///@todo remove?
-  return false;
-}
-
-
 void KEduVocDocument::setSortingEnabled(bool enable)
 {
   d->m_sortingEnabled = enable;
index 02ed7a26ae11845167d215b19197b868f137116b..1841b88cc5beb6ba7e6e93796556aaa5272759dc 100644 (file)
@@ -100,23 +100,6 @@ public:
    */
   void removeEntry(int index);
 
-  /**
-   * Sorts vocabulary alphabetically
-   *
-   * @param index             index identifier (0 = original, 1..n = translations
-   * @returns                 the direction of sorting: true = ascending
-   */
-  bool sort(int index);
-
-  /**
-   * Sorts vocabulary alphabetically
-   *
-   * @param index             index identifier (0 = original, 1..n = translations
-   * @param order             the order used when sorting
-   * @returns                 the direction of sorting: true = ascending
-   */
-  bool sort(int index, Qt::SortOrder order);
-
   /**
    * Shuffles vocabulary in a random order
    */
@@ -129,18 +112,6 @@ public:
    */
   int cleanUp();
 
-  /**
-   * Sorts vocabulary by lesson indices
-   * @returns direction of sorting: true = ascending
-   */
-  bool sortByLessonIndex();
-
-  /**
-   * Sorts vocabulary by lesson name
-   * @returns direction of sorting: true = ascending
-   */
-  bool sortByLessonAlpha();
-
   /**
    * Enables sorting
    */