Warning, /office/kile/CODE-FORMATTING-STYLE.txt is written in an unsupported language. File is not indexed.
0001 When writing code for Kile, it should be formatted as illustrated through the following code snippets: 0002 0003 unsigned int Manager::findFreeID(const QMap<unsigned int, bool>& takenIDMap, unsigned int maxID) 0004 { 0005 if(takenIDMap.size() == 0) { 0006 return 0; 0007 } 0008 // maxID should have a real meaning now 0009 for(unsigned int i = 0; i < maxID; ++i) { 0010 if(takenIDMap.find(i) == takenIDMap.end()) { 0011 return i; 0012 } 0013 } 0014 return (maxID + 1); 0015 } 0016 0017 void Manager::writeIDs() 0018 { 0019 KConfigGroup configGroup = m_config->group("Scripts"); 0020 //delete old entries 0021 QList<unsigned int> idList = configGroup.readEntry("IDs", QList<unsigned int>()); 0022 for(QList<unsigned int>::iterator i = idList.begin(); i != idList.end(); ++i) { 0023 configGroup.deleteEntry("Script" + QString::number(*i)); 0024 } 0025 //write new ones 0026 idList.clear(); 0027 for(QMap<unsigned int, Script*>::iterator i = m_idScriptMap.begin(); i != m_idScriptMap.end(); ++i) { 0028 unsigned int id = i.key(); 0029 idList.push_back(id); 0030 configGroup.writePathEntry("Script" + QString::number(id), (*i)->getFileName()); 0031 } 0032 configGroup.writeEntry("IDs", idList); 0033 } 0034 0035 QPair<int, QString> pair = m_kileInfo->editorKeySequenceManager()->checkSequence(newSequence, oldSequence); 0036 if(pair.first == 0) { 0037 m_kileInfo->scriptManager()->setEditorKeySequence(script, newType, newSequence); 0038 } 0039 KileEditorKeySequence::Action *action = m_kileInfo->editorKeySequenceManager()->getAction(pair.second); 0040 QString description = (!action) ? QString() : action->getDescription(); 0041 switch(pair.first) { 0042 case 1: 0043 <...> 0044 return; 0045 case 2: 0046 <...> 0047 return; 0048 case 3: 0049 <...> 0050 return; 0051 } 0052 0053 The key points are that 4 spaces are used for indentation, opening curly brackets follow on the same line (except 0054 for function declarations), and function arguments are separated by spaces. 0055 0056 Please feel free to ask on the kile-devel mailing list for further explanations!