28 #include <threadweaver/ThreadWeaver.h>
29 #include <threadweaver/Thread.h>
31 #include <kio/netaccess.h>
33 #include <kapplication.h>
34 #include <kstandarddirs.h>
38 #include <QtAlgorithms>
40 #include <QSqlDatabase>
44 #undef KDE_NO_DEBUG_OUTPUT
55 , m_rootNode(ProjectNode(NULL, -1, -1, -1))
62 , m_weaver(new ThreadWeaver::Weaver())
63 , m_completeScan(true)
65 m_weaver->setMaximumNumberOfThreads(1);
67 m_poModel.dirLister()->setAutoErrorHandlingEnabled(
false, NULL);
68 m_poModel.dirLister()->setNameFilter(
"*.po *.pot *.xlf");
70 m_potModel.dirLister()->setAutoErrorHandlingEnabled(
false, NULL);
71 m_potModel.dirLister()->setNameFilter(
"*.pot");
91 m_doneTimer =
new QTimer();
93 connect(m_doneTimer, SIGNAL(timeout()),
this, SLOT(updateTotalsChanged()));
101 m_dirsWaitingForMetadata.
clear();
103 if (m_activeJob != NULL)
108 for (
int pos = 0; pos < m_rootNode.rows.count(); pos ++)
109 deleteSubtree(m_rootNode.rows.at(pos));
118 m_dirsWaitingForMetadata.
clear();
120 if (m_activeJob != NULL)
124 if (m_rootNode.rows.count())
128 for (
int pos = 0; pos < m_rootNode.rows.count(); pos ++)
129 deleteSubtree(m_rootNode.rows.at(pos));
130 m_rootNode.rows.clear();
131 m_rootNode.poCount = 0;
132 m_rootNode.translated = -1;
133 m_rootNode.translated_reviewer = -1;
134 m_rootNode.translated_approver = -1;
135 m_rootNode.untranslated = -1;
136 m_rootNode.fuzzy = -1;
137 m_rootNode.fuzzy_reviewer = -1;
138 m_rootNode.fuzzy_approver = -1;
146 m_poUrl.adjustPath(KUrl::AddTrailingSlash);
147 m_potUrl.adjustPath(KUrl::AddTrailingSlash);
151 if (!poUrl.isEmpty())
152 m_poModel.dirLister()->openUrl(m_poUrl, KDirLister::Reload);
153 if (!potUrl.isEmpty())
154 m_potModel.dirLister()->openUrl(m_potUrl, KDirLister::Reload);
165 if (poIndex.isValid())
167 KFileItem item = m_poModel.itemForIndex(poIndex);
173 KUrl potFile = m_potModel.itemForIndex(potIndex).url();
174 KUrl poFile = potToPo(potFile);
198 QModelIndex bottomRight = indexForPoIndex(po_bottomRight);
202 enqueueNodeForMetadataUpdate(nodeForIndex(topLeft.
parent()));
214 ProjectNode* node = nodeForIndex(parent);
215 int count = node->rows.count();
222 enqueueNodeForMetadataUpdate(nodeForIndex(topLeft.
parent()));
226 void ProjectModel::po_rowsInserted(
const QModelIndex& po_parent,
int first,
int last)
230 ProjectNode* node = nodeForIndex(parent);
235 for (
int pos = first; pos <= last; pos ++)
237 ProjectNode * childNode =
new ProjectNode(node, pos, pos, -1);
238 node->rows.insert(pos, childNode);
241 node->poCount += last - first + 1;
244 for (
int pos = last + 1; pos < node->rows.count(); pos++)
245 node->rows[pos]->rowNumber = pos;
253 generatePOTMapping(pot2PoMapping, po_parent, pot_parent);
255 for (
int pos = node->poCount; pos < node->rows.count(); pos ++)
257 ProjectNode* potNode = node->rows.at(pos);
258 int potIndex = potNode->potRowNumber;
259 int poIndex = pot2PoMapping[potIndex];
266 node->rows.remove(pos);
267 deleteSubtree(potNode);
270 node->rows[poIndex]->potRowNumber = potIndex;
279 enqueueNodeForMetadataUpdate(node);
283 void ProjectModel::pot_rowsInserted(
const QModelIndex& pot_parent,
int start,
int end)
287 ProjectNode* node = nodeForIndex(parent);
289 int insertedCount = end + 1 - start;
297 generatePOTMapping(pot2PoMapping, po_parent, pot_parent);
300 for (
int pos = 0; pos < node->poCount;pos ++)
302 ProjectNode* n=node->rows[pos];
303 if (n->potRowNumber >= start)
304 n->potRowNumber += insertedCount;
308 for (
int potIndex = start; potIndex <= end; potIndex ++)
310 int poIndex = pot2PoMapping[potIndex];
315 node->rows[poIndex]->potRowNumber = potIndex;
320 newPotNodes.
append(potIndex);
325 for (
int pos = start; pos < end; pos ++)
331 int newNodesCount = newPotNodes.
count();
334 int insertionPoint = node->poCount;
335 while ((insertionPoint < node->rows.count()) && (node->rows[insertionPoint]->potRowNumber < start))
338 beginInsertRows(parent, insertionPoint, insertionPoint + newNodesCount - 1);
340 for (
int pos = 0; pos < newNodesCount; pos ++)
342 int potIndex = newPotNodes.
at(pos);
343 ProjectNode * childNode =
new ProjectNode(node, insertionPoint, -1, potIndex);
344 node->rows.insert(insertionPoint, childNode);
349 for (
int pos = insertionPoint; pos < node->rows.count(); pos ++)
351 node->rows[pos]->rowNumber = pos;
352 node->rows[pos]->potRowNumber += insertedCount;
358 enqueueNodeForMetadataUpdate(node);
361 void ProjectModel::po_rowsRemoved(
const QModelIndex& po_parent,
int start,
int end)
365 ProjectNode* node = nodeForIndex(parent);
366 int removedCount = end + 1 - start;
368 if ((!parent.
isValid()) && (node->rows.count() == 0))
380 for (
int pos = end + 1; pos < node->rows.count(); pos ++)
382 ProjectNode* childNode = node->rows.at(pos);
383 childNode->rowNumber -= removedCount;
385 if (childNode->poRowNumber > end)
386 node->rows[pos]->poRowNumber -= removedCount;
390 for (
int pos = end; pos >= start; pos --)
392 int potIndex = node->rows.at(pos)->potRowNumber;
393 deleteSubtree(node->rows.at(pos));
394 node->rows.remove(pos);
397 potRowsToInsert.
append(potIndex);
401 node->poCount -= removedCount;
406 qSort(potRowsToInsert.
begin(), potRowsToInsert.
end());
408 int insertionPoint = node->poCount;
410 for (
int pos = 0; pos < potRowsToInsert.
count(); pos ++)
412 int potIndex = potRowsToInsert.
at(pos);
413 while (insertionPoint < node->rows.count() && node->rows[insertionPoint]->potRowNumber < potIndex)
415 node->rows[insertionPoint]->rowNumber = insertionPoint;
421 ProjectNode * childNode =
new ProjectNode(node, insertionPoint, -1, potIndex);
422 node->rows.insert(insertionPoint, childNode);
428 while (insertionPoint < node->rows.count())
430 node->rows[insertionPoint]->rowNumber = insertionPoint;
434 enqueueNodeForMetadataUpdate(node);
438 void ProjectModel::pot_rowsRemoved(
const QModelIndex& pot_parent,
int start,
int end)
442 ProjectNode * node = nodeForIndex(parent);
443 int removedCount = end + 1 - start;
445 if ((!parent.
isValid()) && (node->rows.count() == 0))
453 int firstPOTToRemove = node->poCount;
454 int lastPOTToRemove = node->rows.count() - 1;
456 while (firstPOTToRemove <= lastPOTToRemove && node->rows[firstPOTToRemove]->potRowNumber < start)
458 while (lastPOTToRemove >= firstPOTToRemove && node->rows[lastPOTToRemove]->potRowNumber > end)
461 if (firstPOTToRemove <= lastPOTToRemove)
465 for (
int pos = lastPOTToRemove; pos >= firstPOTToRemove; pos --)
467 ProjectNode* childNode = node->rows.at(pos);
468 Q_ASSERT(childNode->potRowNumber >= start);
469 Q_ASSERT(childNode->potRowNumber <= end);
470 deleteSubtree(childNode);
471 node->rows.remove(pos);
475 for (
int pos = firstPOTToRemove; pos < node->rows.count(); pos ++)
477 node->rows[pos]->rowNumber = pos;
478 node->rows[pos]->potRowNumber -= removedCount;
488 for (
int poIndex = 0; poIndex < node->poCount; poIndex ++)
490 ProjectNode * childNode = node->rows[poIndex];
491 int potIndex = childNode->potRowNumber;
493 if (potIndex >= start && potIndex <= end)
497 node->rows[poIndex]->potRowNumber = -1;
501 else if (childNode->potRowNumber > end)
504 childNode->potRowNumber -= removedCount;
509 enqueueNodeForMetadataUpdate(node);
521 if (role!=Qt::DisplayRole)
526 case FileName:
return i18nc(
"@title:column File name",
"Name");
527 case Graph:
return i18nc(
"@title:column Graphical representation of Translated/Fuzzy/Untranslated counts",
"Graph");
528 case TotalCount:
return i18nc(
"@title:column Number of entries",
"Total");
529 case TranslatedCount:
return i18nc(
"@title:column Number of entries",
"Translated");
530 case FuzzyCount:
return i18nc(
"@title:column Number of entries",
"Not ready");
531 case UntranslatedCount:
return i18nc(
"@title:column Number of entries",
"Untranslated");
532 case TranslationDate:
return i18nc(
"@title:column",
"Last Translation");
533 case SourceDate:
return i18nc(
"@title:column",
"Template Revision");
534 case LastTranslator:
return i18nc(
"@title:column",
"Last Translator");
543 return Qt::ItemIsSelectable|Qt::ItemIsEnabled;
545 return Qt::ItemIsSelectable;
551 return nodeForIndex(parent)->rows.size();
563 return ((poIndex.
isValid() && m_poModel.hasChildren(poIndex)) ||
564 (potIndex.
isValid() && m_potModel.hasChildren(potIndex)));
575 return ((poIndex.
isValid() && m_poModel.canFetchMore(poIndex)) ||
576 (potIndex.
isValid() && m_potModel.canFetchMore(potIndex)));
594 if (poIndex.
isValid() && (m_poModel.canFetchMore(poIndex)))
595 m_poModel.fetchMore(poIndex);
597 if (potIndex.
isValid() && (m_potModel.canFetchMore(potIndex)))
598 m_potModel.fetchMore(potIndex);
617 ProjectNode* node = nodeForIndex(index);
618 QModelIndex internalIndex = poOrPotIndexForOuter(index);
624 bool isDir = item.isDir();
626 int translated = node->translatedAsPerRole();
627 int fuzzy = node->fuzzyAsPerRole();
628 int untranslated = node->untranslated;
629 bool hasStats = translated != -1;
633 case Qt::DisplayRole:
647 case Qt::ToolTipRole:
653 case KDirModel::FileItemRole:
655 case Qt::DecorationRole:
661 if (hasStats && fuzzy == 0 && untranslated == 0)
662 return m_poComplIcon;
663 else if (node->poRowNumber != -1)
665 else if (node->potRowNumber != -1)
671 return item.isFile()?(fuzzy + untranslated):0;
673 return item.isFile()?fuzzy:0;
675 return item.isFile()?untranslated:0;
677 return item.isFile()?(node->poRowNumber == -1):0;
679 return item.isFile()?(node->potRowNumber == -1):0;
681 return hasStats?(fuzzy + untranslated + translated):0;
690 ProjectNode* parentNode = nodeForIndex(parent);
692 if (row>=parentNode->rows.size())
694 kWarning()<<
"SHIT HAPPENED WITH INDEXES"<<row<<parentNode->rows.size()<<
itemForIndex(parent).url();
697 return createIndex(row, column, parentNode->rows.at(row));
706 return m_poModel.itemForIndex(index);
711 return m_poModel.itemForIndex(poIndex);
717 return m_potModel.itemForIndex(potIndex);
720 kWarning()<<
"returning empty KFileItem()"<<index.
row()<<index.
column();
721 kWarning()<<
"returning empty KFileItem()"<<index.
parent().
isValid();
725 kWarning()<<
"returning empty KFileItem()"<<
static_cast<ProjectNode*
>(index.
internalPointer())->untranslated<<static_cast<ProjectNode*>(index.
internalPointer())->sourceDate;
730 ProjectModel::ProjectNode* ProjectModel::nodeForIndex(
const QModelIndex& index)
const
734 ProjectNode * node =
static_cast<ProjectNode *
>(index.
internalPointer());
735 Q_ASSERT(node != NULL);
740 ProjectNode * node =
const_cast<ProjectNode *
>(&m_rootNode);
741 Q_ASSERT(node != NULL);
747 QModelIndex ProjectModel::indexForNode(
const ProjectNode* node)
749 if (node == &m_rootNode)
752 int row = node->rowNumber;
759 if (m_poUrl.isParentOf(url))
762 return indexForPoIndex(poIndex);
764 else if (m_potUrl.isParentOf(url))
766 QModelIndex potIndex = m_potModel.indexForUrl(url);
767 return indexForPotIndex(potIndex);
778 ProjectNode* childNode = nodeForIndex(childIndex);
779 ProjectNode* parentNode = childNode->parent;
781 if (!parentNode || (childNode == &m_rootNode) || (parentNode == &m_rootNode))
784 return createIndex(parentNode->rowNumber, 0, parentNode);
802 internalParent = indexForOuter(parent, type);
807 ProjectNode* node = nodeForIndex(outerIndex);
809 short rowNumber=(type==PoIndex?node->poRowNumber:node->potRowNumber);
812 return (type==PoIndex?m_poModel:m_potModel).index(rowNumber, outerIndex.
column(), internalParent);
817 return indexForOuter(outerIndex, PoIndex);
823 return indexForOuter(outerIndex, PotIndex);
837 QModelIndex potIndex = potIndexForOuter(outerIndex);
840 kWarning()<<
"error mapping index to PO or POT";
851 int row = poIndex.
row();
862 ProjectNode* node = nodeForIndex(outerParent);
864 int potRow = potIndex.
row();
867 while(row<node->rows.count() && node->rows.at(row)->potRowNumber!=potRow)
870 if (row != node->rows.count())
873 kWarning()<<
"error mapping index from POT to outer, searched for potRow:"<<potRow;
887 int poRows = m_poModel.rowCount(poParent);
888 int potRows = m_potModel.rowCount(potParent);
895 for (
int poPos = 0; poPos < poRows; poPos ++)
897 KFileItem file = m_poModel.itemForIndex(m_poModel.index(poPos, 0, poParent));
898 KUrl potUrl = poToPot(file.url());
899 poOccupiedUrls.
append(potUrl);
902 for (
int potPos = 0; potPos < potRows; potPos ++)
905 KUrl potUrl = m_potModel.itemForIndex(m_potModel.index(potPos, 0, potParent)).url();
906 int occupiedPos = -1;
909 for (
int poPos = 0; occupiedPos == -1 && poPos < poOccupiedUrls.
count(); poPos ++)
911 KUrl& occupiedUrl = poOccupiedUrls[poPos];
912 if (potUrl.equals(occupiedUrl))
916 result.
append(occupiedPos);
921 KUrl ProjectModel::poToPot(
const KUrl& poPath)
const
923 if (!m_poUrl.isParentOf(poPath))
925 kWarning()<<
"PO path not in project: " << poPath.url();
929 QString pathToAdd = KUrl::relativeUrl(m_poUrl, poPath);
935 KUrl potPath = m_potUrl;
936 potPath.addPath(pathToAdd);
942 KUrl ProjectModel::potToPo(
const KUrl& potPath)
const
944 if (!m_potUrl.isParentOf(potPath))
946 kWarning()<<
"POT path not in project: " << potPath.url();
950 QString pathToAdd = KUrl::relativeUrl(m_potUrl, potPath);
954 pathToAdd = pathToAdd.
left(pathToAdd.
length() - 1);
956 KUrl poPath = m_poUrl;
957 poPath.addPath(pathToAdd);
967 void ProjectModel::enqueueNodeForMetadataUpdate(ProjectNode* node)
971 if (m_dirsWaitingForMetadata.
contains(node))
973 if ((m_activeJob != NULL) && (m_activeNode == node))
979 m_dirsWaitingForMetadata.
insert(node);
981 if (m_activeJob == NULL)
982 startNewMetadataJob();
986 void ProjectModel::deleteSubtree(ProjectNode* node)
988 for (
int row = 0; row < node->rows.count(); row ++)
989 deleteSubtree(node->rows.at(row));
991 m_dirsWaitingForMetadata.
remove(node);
993 if ((m_activeJob != NULL) && (m_activeNode == node))
1000 void ProjectModel::startNewMetadataJob()
1002 if (!m_completeScan)
1006 m_activeNode = NULL;
1008 if (m_dirsWaitingForMetadata.
isEmpty())
1011 ProjectNode* node = *m_dirsWaitingForMetadata.
begin();
1014 m_activeNode = node;
1020 for (
int row=0; row < node->rows.count(); row ++)
1025 m_activeJob,SIGNAL(done(ThreadWeaver::Job*)),
1026 this,SLOT(finishMetadataUpdate(ThreadWeaver::Job*)));
1028 m_weaver->enqueue(m_activeJob);
1031 void ProjectModel::finishMetadataUpdate(ThreadWeaver::Job * _job)
1041 if ((m_dirsWaitingForMetadata.
contains(m_activeNode)) && (job->
m_status == 0))
1043 m_dirsWaitingForMetadata.
remove(m_activeNode);
1046 setMetadataForDir(m_activeNode, m_activeJob->
m_info);
1051 for (
int row=0; row < m_activeNode->rows.count(); row++)
1063 startNewMetadataJob();
1078 connect(j,SIGNAL(done(ThreadWeaver::Job*)),
1079 this,SLOT(finishSingleMetadataUpdate(ThreadWeaver::Job*)));
1081 m_weaver->enqueue(j);
1084 void ProjectModel::finishSingleMetadataUpdate(ThreadWeaver::Job* _job)
1099 ProjectNode* node = nodeForIndex(index);
1101 updateDirStats(nodeForIndex(index.
parent()));
1112 int dataCount = data.
count();
1113 int rowsCount = node->rows.count();
1114 Q_ASSERT(dataCount == rowsCount);
1116 for (
int row = 0; row < rowsCount; row ++)
1117 node->rows[row]->setFileStats(data.
at(row));
1122 updateDirStats(node);
1130 void ProjectModel::updateDirStats(ProjectNode* node)
1132 node->calculateDirStats();
1133 if (node == &m_rootNode)
1135 updateTotalsChanged();
1139 updateDirStats(node->parent);
1141 if (node->parent->rows.count()==0 || node->parent->rows.count()>=node->rowNumber)
1144 kWarning()<<index.
row()<<node->parent->rows.count();
1145 if (index.
row()>=node->parent->rows.count())
1152 bool ProjectModel::updateDone(
const QModelIndex& index,
const KDirModel& model)
1154 if (model.canFetchMore(index))
1157 int row=model.rowCount(index);
1160 if (!updateDone(model.index(row, 0, index), model))
1166 void ProjectModel::updateTotalsChanged()
1168 bool done = m_dirsWaitingForMetadata.
isEmpty();
1171 done = updateDone(m_poModel.indexForUrl(m_poUrl), m_poModel) &&
1172 updateDone(m_potModel.indexForUrl(m_potUrl), m_potModel);
1173 if (m_rootNode.fuzzyAsPerRole() + m_rootNode.translatedAsPerRole() + m_rootNode.untranslated > 0 && !done)
1174 m_doneTimer->
start(2000);
1176 emit
totalsChanged(m_rootNode.fuzzyAsPerRole(), m_rootNode.translatedAsPerRole(), m_rootNode.untranslated, done);
1182 ProjectModel::ProjectNode::ProjectNode(ProjectNode* _parent,
int _rowNum,
int _poIndex,
int _potIndex)
1184 , rowNumber(_rowNum)
1185 , poRowNumber(_poIndex)
1186 , potRowNumber(_potIndex)
1189 , translated_reviewer(-1)
1190 , translated_approver(-1)
1193 , fuzzy_reviewer(-10)
1194 , fuzzy_approver(-10)
1199 ProjectModel::ProjectNode::~ProjectNode()
1204 void ProjectModel::ProjectNode::calculateDirStats()
1210 translated_reviewer = 0;
1211 translated_approver = 0;
1214 for (
int pos = 0; pos < rows.count(); pos++)
1216 ProjectNode* child = rows.at(pos);
1217 if (child->translated != -1)
1219 fuzzy += child->fuzzy;
1220 fuzzy_reviewer += child->fuzzy_reviewer;
1221 fuzzy_approver += child->fuzzy_approver;
1222 translated += child->translated;
1223 translated_reviewer += child->translated_reviewer;
1224 translated_approver += child->translated_approver;
1225 untranslated += child->untranslated;
1231 void ProjectModel::ProjectNode::setFileStats(
const KFileMetaInfo& info)
1233 if (info.keys().count() == 0)
1236 translated = info.item(
"translation.translated").value().toInt();
1237 const QVariant translated_reviewer_variant = info.item(
"translation.translated_reviewer").
value();
1238 translated_reviewer = translated_reviewer_variant.
isValid() ? translated_reviewer_variant.
toInt() : translated;
1239 const QVariant translated_approver_variant = info.item(
"translation.translated_approver").
value();
1240 translated_approver = translated_approver_variant.
isValid() ? translated_approver_variant.
toInt() : translated;
1241 untranslated = info.item(
"translation.untranslated").value().toInt();
1242 fuzzy = info.item(
"translation.fuzzy").value().toInt();
1243 const QVariant fuzzy_reviewer_variant = info.item(
"translation.fuzzy_reviewer").
value();
1244 fuzzy_reviewer = fuzzy_reviewer_variant.
isValid() ? fuzzy_reviewer_variant.
toInt() : fuzzy;
1245 const QVariant fuzzy_approver_variant = info.item(
"translation.fuzzy_approver").
value();
1246 fuzzy_approver = fuzzy_approver_variant.
isValid() ? fuzzy_approver_variant.
toInt() : fuzzy;
1247 lastTranslator = info.item(
"translation.last_translator").value().toString();
1248 sourceDate = info.item(
"translation.source_date").value().toString();
1249 translationDate = info.item(
"translation.translation_date").value().toString();
1250 lastTranslator.squeeze();
1251 sourceDate.squeeze();
1252 translationDate.squeeze();
1259 : ThreadWeaver::Job(owner)
1272 queryMain.
exec(
"PRAGMA encoding = \"UTF-8\"");
1273 queryMain.
exec(
"CREATE TABLE IF NOT EXISTS metainfo ("
1274 "filepath INTEGER PRIMARY KEY ON CONFLICT REPLACE, "
1277 "changedate INTEGER"
1286 QString dbName=
"metainfocache";
1290 db.
setDatabaseName(KStandardDirs::locateLocal(
"appdata", dbName+
".sqlite"));
1291 if (KDE_ISUNLIKELY( !db.
open() ))
1292 return KFileMetaInfo(file.url());
1297 return KFileMetaInfo(file.url());
1299 static const QString fields[]={
1300 "translation.translated",
1301 "translation.untranslated",
1302 "translation.fuzzy",
1303 "translation.last_translator",
1304 "translation.source_date",
1305 "translation.translation_date",
1306 "translation.translated_reviewer",
1307 "translation.translated_approver",
1308 "translation.fuzzy_reviewer",
1309 "translation.fuzzy_approver"
1311 static const int nFields =
sizeof(fields) /
sizeof(fields[0]);
1316 queryCache.
prepare(
"SELECT * from metainfo where filepath=?");
1319 if (queryCache.
next() && file.time(KFileItem::ModificationTime).dateTime()==queryCache.
value(2).
toDateTime())
1328 for(
int i=0;i<keys.count();i++)
1329 info.item(fields[i]).setValue(keys.at(i));
1333 KFileMetaInfo info(file.url());
1338 for(
int i=0;i<nFields;i++)
1339 keys[i] = info.item(fields[i]).
value();
1344 query.
prepare(
"INSERT INTO metainfo (filepath, metainfo, changedate) "
1345 "VALUES (?, ?, ?)");
1348 query.
bindValue(2, file.time(KFileItem::ModificationTime).dateTime());
1349 if (KDE_ISUNLIKELY(!query.
exec()))
1350 qWarning() <<
"metainfo cache acquiring error: " <<query.
lastError().
text();
1357 static QString dbName=
"metainfocache";
1372 if ((!file.isNull()) && (!file.isDir()))
1375 if (file.metaInfo(
false).keys().isEmpty())
1379 info=file.metaInfo(
false);
1402 #include "projectmodel.moc"
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
QObject * child(const char *objName, const char *inheritsClass, bool recursiveSearch) const
KUrl beginEditing(const QModelIndex &index)
void setStatus(int status)
void totalsChanged(int fuzzy, int translated, int untranslated, bool done)
QByteArray toByteArray() const
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
void append(const T &value)
bool hasChildren(const QModelIndex &parent=QModelIndex()) const
static void initDataBase(QSqlDatabase &db)
QDateTime toDateTime() const
bool exec(const QString &query)
const T & at(int i) const
QSqlDatabase database(const QString &connectionName, bool open)
QSqlDatabase addDatabase(const QString &type, const QString &connectionName)
bool canFetchMore(const QModelIndex &parent) const
const_iterator insert(const T &value)
Qt::ItemFlags flags(const QModelIndex &index) const
void fetchMore(const QModelIndex &parent)
bool contains(const QString &connectionName)
bool prepare(const QString &query)
int count(const T &value) const
void append(const T &value)
int columnCount(const QModelIndex &parent=QModelIndex()) const
int toInt(bool *ok) const
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
QVariant value(int index) const
void bindValue(const QString &placeholder, const QVariant &val, QFlags< QSql::ParamTypeFlag > paramType)
QList< KFileItem > m_files
void setUrl(const KUrl &poUrl, const KUrl &potUrl)
void beginRemoveRows(const QModelIndex &parent, int first, int last)
void * internalPointer() const
bool endsWith(const QString &s, Qt::CaseSensitivity cs) const
QList< KFileMetaInfo > m_info
QModelIndex parent() const
void rowsRemoved(const QModelIndex &parent, int start, int end)
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
we use QRect to pass data through QVariant tunnel
QModelIndex createIndex(int row, int column, void *ptr) const
QVariant fromValue(const T &value)
bool contains(const T &value) const
void beginInsertRows(const QModelIndex &parent, int first, int last)
const T & at(int i) const
static KFileMetaInfo cachedMetaInfo(const KFileItem &file)
uint qHash(const DocPos &key)
bool remove(const T &value)
QVariant data(int role) const
ProjectModel(QObject *parent)
QModelIndex sibling(int row, int column) const
int count(const T &value) const
QSqlError lastError() const
QModelIndex indexForUrl(const KUrl &url)
QString left(int n) const
UpdateStatsJob(QList< KFileItem > files, QObject *owner=0)
void setDatabaseName(const QString &name)
void slotFileSaved(const KUrl &)
void rowsInserted(const QModelIndex &parent, int start, int end)
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
int rowCount(const QModelIndex &parent=QModelIndex()) const
KFileItem itemForIndex(const QModelIndex &index) const
void setSingleShot(bool singleShot)