#include "commonview.h"
#include <QFile>
#include <QMessageBox>


CommonView::CommonView(ConnectorToServer* connectorToServer, TypeView type, QWidget *parent):
    QWidget(parent),
    connectorToServer(connectorToServer),
    treeWidget(nullptr),
    typeView(type),
    archiveVisible(false),
    notLoggedInVisible(true),
    adminMode(false),
    authComplited(false),
    lastCurrentID(0),
    typeObject(TypeObject::objInstructor)
{
    treeWidget = new QTreeWidget();

    //treeWidget->setIconSize(QSize(20, 20));
    treeWidget->setFocusPolicy(Qt::FocusPolicy::NoFocus);

    //updateMyStyleSheet();
}

void CommonView::setItemColorArchive(QTreeWidgetItem *item)
{
    setItemColor(item,QColor(240, 240, 240));
}

void CommonView::setItemColorNoArchive(QTreeWidgetItem *item)
{
    setItemColor(item,QColor(255, 255, 255));
}

void CommonView::setItemColor(QTreeWidgetItem *item, QColor color)
{
    for (int i = 0; i < item->columnCount(); i++)
        item->setBackground(i, color);
}
