-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfileeditor.cpp
40 lines (32 loc) · 930 Bytes
/
fileeditor.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <QFile>
#include <QTextStream>
#include <QStringList>
#include <QList>
#include "shortcutitem.h"
#include "fileeditor.h"
#include "constants.h"
#include "registryeditor.h"
QStringList FileEditor::readData(){
QStringList list;
QFile file(RegistryEditor::getShortcutAppPath() + "/data.run");
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)){
return list;
}
QTextStream in(&file);
while(!in.atEnd()){
QString item = in.readLine();
list.append(item);
}
file.close();
return list;
}
void FileEditor::writeData(QList<ShortcutItem> theList){
QFile file(RegistryEditor::getShortcutAppPath() + "/data.run");
file.open(QIODevice::WriteOnly | QIODevice::Text);
QTextStream out(&file);
for(int i=0 ; i < theList.size() ; i++){
out <<theList[i].getShortcut() <<"\?" <<theList[i].getPath();
out <<"\n";
}
file.close();
}