From b81b2ae4d0c96b37e442b5c8d2a82d518c50cfff Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sat, 23 May 2009 01:07:11 -0400 Subject: Delete old tree widget files --- sigmodr/tree/BaseModel.cpp | 143 --------------------------------------------- 1 file changed, 143 deletions(-) delete mode 100644 sigmodr/tree/BaseModel.cpp (limited to 'sigmodr/tree/BaseModel.cpp') diff --git a/sigmodr/tree/BaseModel.cpp b/sigmodr/tree/BaseModel.cpp deleted file mode 100644 index 0dceeaa4..00000000 --- a/sigmodr/tree/BaseModel.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright 2008-2009 Ben Boeckel - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -// Header include -#include "BaseModel.h" - -// Sigmod includes -#include - -// KDE includes -#include -#include -#include -#include - -// Qt includes -#include -#include - -using namespace Sigmod; -using namespace Sigmodr::Tree; - -const int BaseModel::TypeRole = Qt::UserRole; -const int BaseModel::DropAcceptRole = Qt::UserRole + 1; -const int BaseModel::XmlRole = Qt::UserRole + 2; -const int BaseModel::WidgetRole = Qt::UserRole + 3; -const int BaseModel::ContextMenuRole = Qt::UserRole + 4; - -BaseModel::BaseModel(BaseModel* parent, Object* object, const QString& name) : - m_parent(parent), - m_object(object), - m_name(name) -{ -} - -BaseModel::~BaseModel() -{ -} - -QVariant BaseModel::data(const int role) const -{ - if (role == TypeRole) - return type(); - else if (role == DropAcceptRole) - return types(); - return QVariant(); -} - -BaseModel* BaseModel::parent() -{ - return m_parent; -} - -int BaseModel::indexNumber() const -{ - if (m_parent) - return m_parent->findChild(const_cast(this)); - return -1; -} - -QString BaseModel::type() const -{ - return ""; -} - -const Object* BaseModel::object() const -{ - return m_object; -} - -bool BaseModel::loadFromData(const QString& data, QDomDocument* xml) const -{ - bool loaded = false; - QString error; - int line; - int column; - KUrl url(data); - if (url.isValid()) - { - QString path; - const bool local = url.isLocalFile(); - if (local) - path = url.path(); - else - { - if (!KIO::NetAccess::download(url, path, KApplication::kApplication()->activeWindow())) - { - KMessageBox::error(KApplication::kApplication()->activeWindow(), KIO::NetAccess::lastErrorString(), "KIO Error"); - return false; - } - } - QFile file(path); - if (file.open(QIODevice::ReadOnly)) - { - if (!xml->setContent(&file, &error, &line, &column)) - { - KMessageBox::error(KApplication::kApplication()->activeWindow(), QString("%1 at line %2, column %3").arg(error).arg(line).arg(column), "XML Error"); - loaded = false; - } - } - else - { - KMessageBox::error(KApplication::kApplication()->activeWindow(), file.errorString(), "File Error"); - loaded = false; - } - file.close(); - if (!local) - KIO::NetAccess::removeTempFile(path); - } - else if (xml->setContent(data, &error, &line, &column)) - loaded = true; - else - KMessageBox::error(KApplication::kApplication()->activeWindow(), QString("%1 at line %2, column %3").arg(error).arg(line).arg(column), "XML Error"); - return loaded; -} - -void BaseModel::childRowChanged(const int row, const Change change) -{ - QList indexes; - indexes << indexNumber() << row; - emit(rowsChanged(indexes, change)); -} - -void BaseModel::childRowsChanged(const QList& rows, const Change change) -{ - QList indexes; - indexes << indexNumber() << rows; - emit(rowsChanged(indexes, change)); -} -- cgit